Отправить SMS / 2Way SMS
Метод позволяет отправлять SMS-сообщения.
Поддерживается создание одиночного SMS ("destination": "phone"), массовой рассылки ("destination": "phones") и настраиваемого SMS ("destination": "individual").
Чтобы отправить рассылку, сделайте запрос по этому URL-адресу:
PUT (POST) https://api.notificore.ru/rest/sms/create
Single SMS
Request parameters
Parameter | Required | Type | Description |
---|---|---|---|
destination | Yes | string | set to “phone” |
originator | Yes | string | sender. String up to 14 characters |
body | Yes | string | SMS message text |
msisdn | Yes | string | phone number to which the SMS is sent |
reference | No | string | SMS external ID. String up to 32 characters containing /a-zA-Z0-9/ |
validity | No | integer | SMS validity time. The default is 72 hours. Integer from 1 to 72 |
tariff | No | integer | tariff number. The default is 0. Integer from 0 to 9 |
2way | No | bool | belonging to 2WAY |
Пример запроса
{
"destination":"phone",
"msisdn": "792501234579",
"reference": "reference_id",
"originator": "sender",
"body":"test sms",
"2way": 1
}
Response parameters
Parameter | Type | Description |
---|---|---|
id | integer | the message ID, a unique random identifier that is created on the platform when an object is created |
reference | string | SMS external ID |
price | float | SMS price |
currency | string | сurrency in which the SMS price is specified |
Если запрос успешен, вы получите ответ:
{
"error":"0",
"id":"22125",
"reference":"12erdgm9",
"price":"5.02",
"currency":"RUB"
}
Bulk SMS campaign
Bulk SMS campaign contains one text for all recipient numbers.
Request parameters
Parameter | Required | Type | Description |
---|---|---|---|
destination | Yes | string | set to “phones” |
phones | Yes | array | values array |
msisdn | Yes | string | phone number to which the SMS is sent |
reference | No | string | SMS external ID. String up to 32 characters containing /a-zA-Z0-9/ |
originator | Yes | string | Sender name. String up to 14 characters |
body | Yes | string | SMS message text |
validity | No | integer | SMS validity time. The default is 72 hours. Integer from 1 to 72 |
tariff | No | integer | tariff number. The default is 0. Integer from 0 to 9 |
2way | No | bool | belonging to 2WAY |
Пример запроса
{
"destination":"phones",
"phones":[
{"msisdn": "792972000001","reference":"12erdgm9"},
{"msisdn": "792972000002","reference":"12erdgn0"}
],
"originator":"test",
"body":"test sms",
"validity": 72,
"tariff":9
}
Response parameters
Parameter | Type | Description |
---|---|---|
id | integer | SMS ID |
reference | string | SMS external ID |
price | float | SMS price |
currency | string | сurrency in which the SMS price is specified |
task_id | integer | Campaign ID, which is generated automatically by the system when creating a campaign. The task_id parameter is used to request the status of the entire campaign |
Если запрос успешен, вы получите ответ:
{
"result":
[
{"reference":"12erdgm9",
"id":"12345",
"error":"0",
"price":"5.06",
"currency":"RUB"},
{"reference":"12erdgn0",
"id":"12346",
"error":"0",
"price":"5.06",
"currency":"RUB"}
],
"error":"0",
"task_id":"21902"
}
Customized SMS campaign
Request parameters
Parameter | Required | Type | Description |
---|---|---|---|
destination | Yes | string | set to “individual” |
validity | No | integer | SMS validity time. The default is 72 hours. Integer from 1 to 72 |
tariff | No | integer | tariff number. The default is 0. Integer from 0 to 9 |
2way | No | bool | belonging to 2WAY |
phones | Yes | array | values array |
msisdn | Yes | string | phone number to which the SMS is sent |
reference | No | string | SMS external ID. String up to 32 characters containing /a-zA-Z0-9/ |
originator | Yes | string | Sender name. String up to 14 characters |
body | Yes | string | SMS message text |
Пример запроса
{
"validity": 72,
"tariff":9,
"destination":"individual",
"phones":
[
{"originator":"test1",
"body":"test sms1",
"msisdn":"792972000001",
"reference": "12erdgm9"},
{"originator":"test2",
"body":"test sms2",
"msisdn": "79272000002",
"reference": "12erdgn0"}
]
}
Response parameters
Parameter | Type | Description |
---|---|---|
id | integer | SMS ID |
reference | string | SMS external ID |
price | float | SMS price |
currency | string | сurrency in which the SMS price is specified |
total price | float | total campaign price. |
currency | string | сurrency in which the campaign price is specified |
Если запрос успешен, вы получите ответ:
{
"result":
[
{"reference":"12erdgm9",
"id":"12345",
"error":"0",
"price":"5.06",
"currency":"RUB"},
{"reference":"12erdgn0",
"id":"12346",
"error":"0",
"price":"5.06",
"currency":"RUB"}
],
"error":"0",
"totalprice":"10.12",
"currency":"RUB"
}