SMS#
Request to Send SMS#
To generate a test request with your parameters, please
open the request generator.
Request Examples#
1 {
2 "login":"YOUR_LOGIN",
3 "password":"YOUR_PASSWORD",
4 "destAddr":"Subscriber's_Number",
5 "message":{
6 "type":"SMS",
7 "data":{
8 "text":"Text. Follow link: <http://verylongurl.com/very/long/url>",
9 "serviceNumber":"SENDER'S_NAME",
10 "ttl":10
11 }
12 }
13 }
1 {
2 "login":"YOUR_LOGIN",
3 "password":"YOUR_PASSWORD",
4 "useTimeDiff":true,
5 "id":"8770630",
6 "shortenLinks":false,
7 "registeredDelivery":"1",
8 "notifyUrl":"URL_for_sending_statuses"
9 "scheduleInfo":{
10 "timeBegin":"10:00",
11 "timeEnd":"12:00",
12 "weekdaysSchedule":"123"
13 },
14 "destAddr":"Subscriber's_Number",
15 "message":{
16 "type":"SMS",
17 "data":{
18 "text":"Текст. Follow link: <http://verylongurl.com/very/long/url>",
19 "serviceNumber":"SENDER'S_NAME",
20 "ttl":10
21 }
22 }
23 }
Parameters#
Parameter |
Required |
Data type |
Description |
|---|---|---|---|
login |
yes |
string |
Partner’s name in the system. |
password |
yes |
string |
Partner’s password in the system. |
useTimeDiff |
no |
boolean |
Taking into account the time zone when starting messaging. More details
If
If
Default value: |
id |
no |
string |
Unique identifier on the Partner’s side. More detailsThis parameter is necessary for controlling repeated submissions and duplication (the control service is activated separately). The Partner can call the Service Provider (request to send a message) multiple times with the same ID. In this case, the message will be sent to the subscriber only once (on the first request). In response to the requests, the Service Provider will return the same message identifier in the Service Provider's system to the Partner (the same as for the first request). The Service Provider optionally returns this identifier to the Partner in the message delivery report if it is available. |
shortenLinks |
no |
boolean |
Parameter controls the automatic shortening of long links in the message. More detailsPossible values are:
If the parameter is not included in the request, but the service is available to the Partner, the links will be shortened by default. The ability to use this service is discussed and configured in advance by the Service Provider. For more details: Link Shortening Service. |
scheduleInfo |
no |
object |
Messaging schedule. More detailsIf not specified, it is sent immediately upon receipt of the request. |
scheduleInfo/timeBegin |
no |
string |
Start time. More details
Example: |
scheduleInfo/timeEnd |
no |
string |
End time. More details
Example: |
scheduleInfo/
weekdaysSchedule
|
no |
string |
Messaging days. More details
Specified by numbers from If there are no restrictions on days of the week, this parameter can be empty or not delivered in the request. |
scheduleInfo/deadline |
no |
string |
End date of the messaging. More details
Example: |
destAddr |
yes |
string |
Subscriber’s phone number. More detailsIt contains the country code, operator code and phone number.
For the Russian Federation, the code can be
Examples: |
message |
yes |
object |
Parameters of a message being sent. |
message/type |
yes |
enum |
Message type. More details
The value of |
message/data |
yes |
object |
Parameters of the data being sent. |
message/data/text |
yes |
string |
Text of the message being sent. More detailsCharacter limit: no more than 2000. |
message/data/
serviceNumber
|
no |
string |
Service name from which the message is being sent. More detailsThis parameter is required in the request when a service name is not specified in the client settings. If it is specified, then it becomes optional in the request. If it is specified in the client settings and passed in the request, the message to the subscriber will be sent from the name specified in the request. |
message/data/ttl |
no |
integer |
Message lifetime. More detailsAcceptable range in minutes: from 1 to 2880. Note When |
message/data/ttlUnit |
no |
enum |
Unit of measurement of the message delivery period. More details
It is transmitted only with
Possible values are: |
registeredDelivery |
no |
integer |
Requirement of delivery reports. More detailsPossible values are:
|
notifyUrl |
no |
string |
Hostname of the incoming API to receive the delivery report. More detailsThis parameter is optional in the request, but if sent you should consider the following: if the parameter is specified, it cannot be empty.
The If any of the specified conditions are not met, an error will be generated and the request will not be executed. |
extraParam |
no |
string |
Additional parameters passed as More details
The comma character cannot be included in the parameter name,
but it can be included in its value — in this case it must be doubled.
Example: the string
|
cascadeChainLink |
no |
object |
Cascading message parameters. More details |
Response#
After sending the message, the Service Provider synchronously returns a response. In case of a successful submission, HTTP code 200 OK is returned.
Successful SMS Sending#
1 {
2 "mtNum": "7390612217"
3 "id": "8770599"
4 }
Parameter |
Data type |
Description |
|---|---|---|
mtNum |
string |
Identifier of the sending chain assigned by the Service Provider platform. |
id |
string |
Unique identifier on the Partner’s side. It is present if it provided when sending. |
SMS Sending Errors#
For error responses, the HTTP response code will be different from 200 (see Error Codes).
1 {
2 "error": {
3 "code": 9,
4 "description": "Message type is not correct"
5 },
6 "extendedDescription": "SMS sending is not allowed for *user*."
7 }
Parameter |
Data type |
Description |
|---|---|---|
error |
object |
Error information. |
error/code |
int |
Error code. |
error/description |
string |
A brief description of the error. |
extendedDescription |
string |
Detailed description of the error (optional parameter). |
Error Codes#
Code |
Description |
HTTP-code |
|---|---|---|
1 |
Service is unavailable |
503 |
2 |
Invalid IP-address |
403 |
3 |
Too many connections |
429 |
4 |
Invalid request |
400 |
5 |
Invalid login |
401 |
6 |
Invalid password |
401 |
7 |
serviceNumber is not defined |
400 |
8 |
destAddr is not correct |
406 |
9 |
Message type is not correct |
406 |
10 |
Prohibited sending duplicates |
409 |
11 |
Invalid TTL |
406 |
100 |
100 |
500 |
SMS Delivery Statuses#
To receive SMS message statuses, you need to set up the Delivery Status Service.
Warning
For SMS messages sent to subscribers of the Megafon operator, from the 01.03.2023 the transmission of the “Delivered” and “Undelivered” statuses is stopped.
Delivery Error Codes#
Delivery error codes for each message type are provided in the corresponding tab of the Description of Error Codes (parameter status=5) section.