HTTPS API v2 / Sending messages VOICE
Principle of operation
To send a voice message using the WAV file, you need to load a media file using the option of uploading files. Only after downloading the necessary files (WAV files with specified parameters), it is possible to send messages VOICE, where the subscriber specifies the file identifier for dispatch. The file must have strictly defined parameters, ie WAV format, parameters 16 Bit, 8 KHz, 128 kbit / sec, mono - 1 channel, max. 60 seconds). Otherwise, the file will not be saved in the system and will not be able to be used for shipment.
Uploading file
Saving the file on the server consists in sending the URL of the file along with the appropriate parameters. The system will check if the file exists and if it meets the requirements. If the verification is successful, the data will be saved on the server and the subscriber will receive a JSON / XML document containing the file identifier. The file is sent in the following way:
files/add
Available parameters
Parameter | Type | An example value or format | Description |
username | String | login | Username used to dispatch the message |
password | String | password | Password to the account |
type | String | mms or voice | Type file. |
url | String | eg.: http://www.serwer.pl/kat/plik.jpg | URL file |
file | String | file | Upload the file from the disk. The "url" must remain empty. Only for MMS files. |
As a result, a JSON document will be generated, e.g. as follows:
{
"success": true,
"id": "b67d70c22d"
}
Listing files
To list the files uploaded to the server and retrieve their IDs, which then can be used in dispatch VOICE, call the following query:
files/index
As a result, a JSON document will be generated, e.g. as follows:
{
"items":[{
"id":"c386a0d459",
"name":"plik1.wav",
"size":32184,
"type":"voice",
"date":"2014-10-06 15:20:37"
},
{
"id":"41cdaf1e99",
"name":"plik2.wav",
"size":46126,
"type":"voice",
"date":"2014-10-06 15:18:37"
},
{
"id":"4941a4cabd",
"name":"plik3.wav",
"size":52144,
"type":"voice",
"date":"2014-10-06 15:00:34"
}]
}
Dispatch Voice
To send a VOICE message using the Remote Service, call the specified URL using the POST method:
messages/send_voice
Available parameters
Parameter | Type | An example value or format | Description |
---|---|---|---|
username | String | login | Username used to dispatch the message |
password | String | password | Password to the account |
phone | String|Array | +48500600700 | The number or numbers appear in a table. |
file_id | String | ID file | ID file can be downloaded by first upload and listing of available files for the service VOICE. |
text | String |
Message content |
An optional parameter that allows the dispatch of the text message processed by the speech synthesizer. In order to dispatch the text as a voice message file_id parameter must be left empty. |
lector | String | Maja, Agnieszka, Jacek and Ewa, Jan or empty value (the default reader May) |
It refers to a voice message with the content in the form of a text read by the synthesizer. Default teacher this Maja. |
details | Boolean | true, false or none |
The parameter displays in response to feedback details sent messages. |
sender_number | String | +48500600700 |
Optionally, the number of the connection is established. You can use the numbers NDI, pre-defined numbers and add their own numbers (from the Customer Panel). By default, if no parameter connection is established from a blocked number. |
test | Boolean | true, false or none |
An optional parameter, allowing you to check the question sending a message. In response document is generated JSON / XML identical to the standard question, but the message is not sent. Useful for testing applications. |
dlr_url | String |
http://www.twojadres.pl/skrypt.php?smsid=#SMSID#&stan=#STAN#&data=#DATA# |
This parameter allows the transmission method Push delivery reports URL on the client. Set this option to query the API override the settings in the Customer Panel. The address should be passed in encrypted form by the urlencode (). Address to forward reports applies to all messages submitted for execution within a single query. Available parameters: #SMSID# - message ID |
The parameters in bold are obligatory. Others are optional.
The return generated after sending is the same as in the case of sending an SMS message.{
"success":true,
"queued":2,
"unsent":2,
"items":[{
"id":"32039da8e9",
"phone":"+48500600700",
"status":"queued",
"queued":"2014-10-20 12:32:52",
"parts":1,
"text":"WAV"
},
{
"id":"844c2b4af0",
"phone":"+48500600500",
"status":"queued",
"queued":"2014-10-20 12:32:52",
"parts":1,
"text":"WAV"
},
{
"id":"6e373d7856",
"phone":"45616",
"status":"unsent",
"queued":"2014-10-20 12:32:52",
"error_code":3103,
"error_message":"Incorrect number",
"text":"WAV"
},
{
"id":"bf069fe2c1",
"phone":"7799123",
"status":"unsent",
"queued":"2014-10-20 12:32:52",
"error_code":3103,
"error_message":"Incorrect number",
"text":"WAV"
}]
}
Recommended settings
In the case of medium and large amounts of sent messages of a few thousand or more, it is recommended to forward messages in "packs" of about 50-200 numbers in one question. This will greatly speed up the process of data transfer to SerwerSMS.pl and reduce the number of queries necessary to send.
If the same file is sent, it is optimal to upload it once and then use its identifier for subsequent messages.