Send fully-featured textual message
Send advanced SMS with all available features and parameters.
Resource
https://api.infobip.com/sms/2/text/advanced
Parameters
Property name | Type | Description |
---|---|---|
bulkId | string | The ID which uniquely identifies the request. Bulk ID will be received only when you send a message to more than one destination address. |
from | string | Represents a sender ID which can be alphanumeric or numeric. Alphanumeric sender ID length should be between 3 and 11 characters (Example: CompanyName ). Numeric sender ID length should be between 3 and 14 characters. |
to* | string | Message destination address. Addresses must be in international format (Example: 41793026727 ). |
messageId | string | The ID that uniquely identifies the message sent. |
text | string | Text of the message that will be sent. |
flash | boolean | Can be true or false . If the value is set to true , a flash SMS will be sent. Otherwise, a normal SMS will be sent. The default value is false . |
transliteration | string | Conversion of a message text from one script to another. Possible values: "TURKISH" , "GREEK" , "CYRILLIC" , "CENTRAL_EUROPEAN" and "NON_UNICODE" . |
languageCode | string | Code for language character set of a message text. Possible values: TR for Turkish, ES for Spanish and PT for Portuguese. |
intermediateReport | boolean | The real-time Intermediate delivery report that will be sent on your callback server. Can be true or false . |
notifyUrl | string | The URL on your callback server on which the Delivery report will be sent. |
notifyContentType | string | Preferred Delivery report content type. Can be application/json or application/xml . |
callbackData | string | Additional client's data that will be sent on the notifyUrl. The maximum value is 200 characters. |
validityPeriod | int | The message validity period in minutes. When the period expires, it will not be allowed for the message to be sent. Validity period longer than 48h is not supported (in this case, it will be automatically set to 48h). |
sendAt | datetime | Date and time when the message is to be sent. Used for scheduled SMS (SMS not sent immediately, but at scheduled time). |
deliveryTimeWindow | object | Scheduling object that allows setting up detailed time windows in which the message can be sent. Consists of from , to and days properties. Days property is mandatory. From and to properties should be either both included, to allow finer time window granulation or both omitted, to include whole days in the delivery time window. |
from | object | Exact time of day in which the sending can start. Consists of hour and minute properties, both mandatory. Time is expressed in the UTC time zone. |
to | object | Exact time of day in which the sending will end. Consists of hour and minute properties, both mandatory. Time is expressed in the UTC time zone. |
hour | int | Hour when the time window opens when used in from property or closes when used in to property. |
minute | int | Minute when the time window opens when used in from property or closes when used in to property. |
days | array_string | Days which are included in the delivery time window. Values are: MONDAY , TUESDAY , WEDNESDAY , THURSDAY , FRIDAY , SATURDAY , SUNDAY . At least one day must be stated. |
track | string | Indicates if the message has to be tracked for Conversion rates. Possible values: SMS and URL |
processKey | string | Key that uniquely identifies Conversion tracking process. |
type | string | User-defined type of the Conversion tracking process or flow type or message type, etc. Example: ONE_TIME_PIN or SOCIAL_INVITES . |
baseUrl | string | Custom base url used for shortening links from SMS text in URL Conversion rate tracking use-case. |
Request Example
POST /sms/2/text/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
Content-Type: application/json
{
"bulkId":"BULK-ID-123-xyz",
"messages":[
{
"from":"InfoSMS",
"destinations":[
{
"to":"41793026727",
"messageId":"MESSAGE-ID-123-xyz"
},
{
"to":"41793026731"
}
],
"text":"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.",
"flash":false,
"language":{
"languageCode":"TR"
},
"transliteration":"TURKISH",
"intermediateReport":true,
"notifyUrl":"https://www.example.com/sms/advanced",
"notifyContentType":"application/json",
"callbackData":"DLR callback data",
"validityPeriod": 720
},
{
"from":"41793026700",
"destinations":[
{
"to":"41793026785"
}
],
"text":"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.",
"sendAt":"2015-07-07T17:00:00.000+01:00",
"deliveryTimeWindow": {
"from": {
"hour": 6,
"minute": 0
},
"to": {
"hour": 15,
"minute": 30
},
"days": [
"MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"
]
}
}
],
"tracking":{
"track":"SMS",
"type":"MY_CAMPAIGN"
}
}
POST /sms/2/text/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/xml
<request>
<bulkId>BULK-ID-123-xyz</bulkId>
<messages>
<message>
<from>InfoSMS</from>
<destinations>
<destination>
<to>41793026727</to>
<messageId>MESSAGE-ID-123-xyz</messageId>
</destination>
<destination>
<to>41793026731</to>
</destination>
</destinations>
<text>Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.</text>
<flash>false</flash>
<language>
<languageCode>TR</languageCode>
</language>
<transliteration>TURKISH</transliteration>
<notifyUrl>https://www.example.com/sms/advanced</notifyUrl>
<notifyContentType>application/json</notifyContentType>
<callbackData>DLR callback data</callbackData>
<validityPeriod>720</validityPeriod>
</message>
<message>
<from>41793026700</from>
<destinations>
<destination>
<to>41793026785</to>
</destination>
</destinations>
<text>A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.</text>
<sendAt>2015-07-07T17:00:00.000+01:00</sendAt>
<deliveryTimeWindow>
<from>
<hour>6</hour>
<minute>0</minute>
</from>
<to>
<hour>15</hour>
<minute>30</minute>
</to>
<days>MONDAY</days>
<days>TUESDAY</days>
<days>WEDNESDAY</days>
<days>THURSDAY</days>
<days>FRIDAY</days>
<days>SATURDAY</days>
<days>SUNDAY</days>
</deliveryTimeWindow>
</message>
</messages>
</request>
curl -X POST \
https://api.infobip.com/sms/2/text/advanced \
-H 'accept: application/json' \
-H 'authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
-H 'content-type: application/json' \
-d '{
"bulkId":"BULK-ID-123-xyz",
"messages":[
{
"from":"InfoSMS",
"destinations":[
{
"to":"41793026727",
"messageId":"MESSAGE-ID-123-xyz"
},
{
"to":"41793026731"
}
],
"text":"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.",
"flash":false,
"language":{
"languageCode":"TR"
},
"transliteration":"TURKISH",
"intermediateReport":true,
"notifyUrl":"https://www.example.com/sms/advanced",
"notifyContentType":"application/json",
"callbackData":"DLR callback data",
"validityPeriod": 720
},
{
"from":"41793026700",
"destinations":[
{
"to":"41793026785"
}
],
"text":"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.",
"sendAt":"2015-07-07T17:00:00.000+01:00",
"deliveryTimeWindow": {
"from": {
"hour": 6,
"minute": 0
},
"to": {
"hour": 15,
"minute": 30
},
"days": [
"MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"
]
}
}
],
"tracking":{
"track":"SMS",
"type":"MY_CAMPAIGN"
}
}'
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.infobip.com/sms/2/text/advanced",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\r\n\t\"bulkId\":\"BULK-ID-123-xyz\",\r\n\t\"messages\":[\r\n\t\t{\r\n\t\t\t\"from\":\"InfoSMS\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026727\",\r\n\t\t\t\t\t\"messageId\":\"MESSAGE-ID-123-xyz\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026731\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.\",\r\n\t\t\t\"flash\":false,\r\n\t\t\t\"language\":{\r\n\t\t\t\t\"languageCode\":\"TR\"\r\n\t\t\t},\r\n\t\t\t\"transliteration\":\"TURKISH\",\r\n\t\t\t\"intermediateReport\":true,\r\n\t\t\t\"notifyUrl\":\"https://www.example.com/sms/advanced\",\r\n\t\t\t\"notifyContentType\":\"application/json\",\r\n\t\t\t\"callbackData\":\"DLR callback data\",\r\n\t\t\t\"validityPeriod\": 720\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"from\":\"41793026700\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026785\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\",\r\n\t\t\t\"sendAt\":\"2015-07-07T17:00:00.000+01:00\",\r\n\t\t\t\"deliveryTimeWindow\": {\r\n\t\t\t\t\"from\": {\r\n\t\t\t\t\t\"hour\": 6,\r\n\t\t\t\t\t\"minute\": 0\r\n\t\t\t\t},\r\n\t\t\t\t\"to\": {\r\n\t\t\t\t\t\"hour\": 15,\r\n\t\t\t\t\t\"minute\": 30\r\n\t\t\t\t},\r\n\t\t\t\t\"days\": [\r\n\t\t\t\t\t\"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\", \"SUNDAY\"\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\t],\r\n\t\"tracking\":{\r\n\t\t\"track\":\"SMS\",\r\n\t\t\"type\":\"MY_CAMPAIGN\"\r\n\t}\r\n}",
CURLOPT_HTTPHEADER => array(
"accept: application/json",
"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'
url = URI("https://api.infobip.com/sms/2/text/advanced")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["accept"] = 'application/json'
request.body = "{\r\n\t\"bulkId\":\"BULK-ID-123-xyz\",\r\n\t\"messages\":[\r\n\t\t{\r\n\t\t\t\"from\":\"InfoSMS\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026727\",\r\n\t\t\t\t\t\"messageId\":\"MESSAGE-ID-123-xyz\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026731\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.\",\r\n\t\t\t\"flash\":false,\r\n\t\t\t\"language\":{\r\n\t\t\t\t\"languageCode\":\"TR\"\r\n\t\t\t},\r\n\t\t\t\"transliteration\":\"TURKISH\",\r\n\t\t\t\"intermediateReport\":true,\r\n\t\t\t\"notifyUrl\":\"https://www.example.com/sms/advanced\",\r\n\t\t\t\"notifyContentType\":\"application/json\",\r\n\t\t\t\"callbackData\":\"DLR callback data\",\r\n\t\t\t\"validityPeriod\": 720\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"from\":\"41793026700\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026785\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\",\r\n\t\t\t\"sendAt\":\"2015-07-07T17:00:00.000+01:00\",\r\n\t\t\t\"deliveryTimeWindow\": {\r\n\t\t\t\t\"from\": {\r\n\t\t\t\t\t\"hour\": 6,\r\n\t\t\t\t\t\"minute\": 0\r\n\t\t\t\t},\r\n\t\t\t\t\"to\": {\r\n\t\t\t\t\t\"hour\": 15,\r\n\t\t\t\t\t\"minute\": 30\r\n\t\t\t\t},\r\n\t\t\t\t\"days\": [\r\n\t\t\t\t\t\"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\", \"SUNDAY\"\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\t],\r\n\t\"tracking\":{\r\n\t\t\"track\":\"SMS\",\r\n\t\t\"type\":\"MY_CAMPAIGN\"\r\n\t}\r\n}"
response = http.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("api.infobip.com")
payload = "{\r\n\t\"bulkId\":\"BULK-ID-123-xyz\",\r\n\t\"messages\":[\r\n\t\t{\r\n\t\t\t\"from\":\"InfoSMS\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026727\",\r\n\t\t\t\t\t\"messageId\":\"MESSAGE-ID-123-xyz\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026731\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.\",\r\n\t\t\t\"flash\":false,\r\n\t\t\t\"language\":{\r\n\t\t\t\t\"languageCode\":\"TR\"\r\n\t\t\t},\r\n\t\t\t\"transliteration\":\"TURKISH\",\r\n\t\t\t\"intermediateReport\":true,\r\n\t\t\t\"notifyUrl\":\"https://www.example.com/sms/advanced\",\r\n\t\t\t\"notifyContentType\":\"application/json\",\r\n\t\t\t\"callbackData\":\"DLR callback data\",\r\n\t\t\t\"validityPeriod\": 720\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"from\":\"41793026700\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026785\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\",\r\n\t\t\t\"sendAt\":\"2015-07-07T17:00:00.000+01:00\",\r\n\t\t\t\"deliveryTimeWindow\": {\r\n\t\t\t\t\"from\": {\r\n\t\t\t\t\t\"hour\": 6,\r\n\t\t\t\t\t\"minute\": 0\r\n\t\t\t\t},\r\n\t\t\t\t\"to\": {\r\n\t\t\t\t\t\"hour\": 15,\r\n\t\t\t\t\t\"minute\": 30\r\n\t\t\t\t},\r\n\t\t\t\t\"days\": [\r\n\t\t\t\t\t\"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\", \"SUNDAY\"\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\t],\r\n\t\"tracking\":{\r\n\t\t\"track\":\"SMS\",\r\n\t\t\"type\":\"MY_CAMPAIGN\"\r\n\t}\r\n}"
headers = {
'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
'accept': "application/json",
'content-type': "application/json"
}
conn.request("POST", "/sms/2/text/advanced", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.post("https://api.infobip.com/sms/2/text/advanced")
.header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
.header("accept", "application/json")
.header("content-type", "application/json")
.body("{\r\n\t\"bulkId\":\"BULK-ID-123-xyz\",\r\n\t\"messages\":[\r\n\t\t{\r\n\t\t\t\"from\":\"InfoSMS\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026727\",\r\n\t\t\t\t\t\"messageId\":\"MESSAGE-ID-123-xyz\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026731\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.\",\r\n\t\t\t\"flash\":false,\r\n\t\t\t\"language\":{\r\n\t\t\t\t\"languageCode\":\"TR\"\r\n\t\t\t},\r\n\t\t\t\"transliteration\":\"TURKISH\",\r\n\t\t\t\"intermediateReport\":true,\r\n\t\t\t\"notifyUrl\":\"https://www.example.com/sms/advanced\",\r\n\t\t\t\"notifyContentType\":\"application/json\",\r\n\t\t\t\"callbackData\":\"DLR callback data\",\r\n\t\t\t\"validityPeriod\": 720\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"from\":\"41793026700\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026785\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\",\r\n\t\t\t\"sendAt\":\"2015-07-07T17:00:00.000+01:00\",\r\n\t\t\t\"deliveryTimeWindow\": {\r\n\t\t\t\t\"from\": {\r\n\t\t\t\t\t\"hour\": 6,\r\n\t\t\t\t\t\"minute\": 0\r\n\t\t\t\t},\r\n\t\t\t\t\"to\": {\r\n\t\t\t\t\t\"hour\": 15,\r\n\t\t\t\t\t\"minute\": 30\r\n\t\t\t\t},\r\n\t\t\t\t\"days\": [\r\n\t\t\t\t\t\"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\", \"SUNDAY\"\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\t],\r\n\t\"tracking\":{\r\n\t\t\"track\":\"SMS\",\r\n\t\t\"type\":\"MY_CAMPAIGN\"\r\n\t}\r\n}")
.asString();
var client = new RestClient("https://api.infobip.com/sms/2/text/advanced");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("accept", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
request.AddParameter("application/json", "{\r\n\t\"bulkId\":\"BULK-ID-123-xyz\",\r\n\t\"messages\":[\r\n\t\t{\r\n\t\t\t\"from\":\"InfoSMS\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026727\",\r\n\t\t\t\t\t\"messageId\":\"MESSAGE-ID-123-xyz\"\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026731\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.\",\r\n\t\t\t\"flash\":false,\r\n\t\t\t\"language\":{\r\n\t\t\t\t\"languageCode\":\"TR\"\r\n\t\t\t},\r\n\t\t\t\"transliteration\":\"TURKISH\",\r\n\t\t\t\"intermediateReport\":true,\r\n\t\t\t\"notifyUrl\":\"https://www.example.com/sms/advanced\",\r\n\t\t\t\"notifyContentType\":\"application/json\",\r\n\t\t\t\"callbackData\":\"DLR callback data\",\r\n\t\t\t\"validityPeriod\": 720\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"from\":\"41793026700\",\r\n\t\t\t\"destinations\":[\r\n\t\t\t\t{\r\n\t\t\t\t\t\"to\":\"41793026785\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"text\":\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\",\r\n\t\t\t\"sendAt\":\"2015-07-07T17:00:00.000+01:00\",\r\n\t\t\t\"deliveryTimeWindow\": {\r\n\t\t\t\t\"from\": {\r\n\t\t\t\t\t\"hour\": 6,\r\n\t\t\t\t\t\"minute\": 0\r\n\t\t\t\t},\r\n\t\t\t\t\"to\": {\r\n\t\t\t\t\t\"hour\": 15,\r\n\t\t\t\t\t\"minute\": 30\r\n\t\t\t\t},\r\n\t\t\t\t\"days\": [\r\n\t\t\t\t\t\"MONDAY\", \"TUESDAY\", \"WEDNESDAY\", \"THURSDAY\", \"FRIDAY\", \"SATURDAY\", \"SUNDAY\"\r\n\t\t\t\t]\r\n\t\t\t}\r\n\t\t}\r\n\t],\r\n\t\"tracking\":{\r\n\t\t\"track\":\"SMS\",\r\n\t\t\"type\":\"MY_CAMPAIGN\"\r\n\t}\r\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
var data = JSON.stringify({
"bulkId": "BULK-ID-123-xyz",
"messages": [
{
"from": "InfoSMS",
"destinations": [
{
"to": "41793026727",
"messageId": "MESSAGE-ID-123-xyz"
},
{
"to": "41793026731"
}
],
"text": "Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.",
"flash": false,
"language": {
"languageCode": "TR"
},
"transliteration": "TURKISH",
"intermediateReport": true,
"notifyUrl": "https://www.example.com/sms/advanced",
"notifyContentType": "application/json",
"callbackData": "DLR callback data",
"validityPeriod": 720
},
{
"from": "41793026700",
"destinations": [
{
"to": "41793026785"
}
],
"text": "A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.",
"sendAt": "2015-07-07T17:00:00.000+01:00",
"deliveryTimeWindow": {
"from": {
"hour": 6,
"minute": 0
},
"to": {
"hour": 15,
"minute": 30
},
"days": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY",
"SATURDAY",
"SUNDAY"
]
}
}
],
"tracking": {
"track": "SMS",
"type": "MY_CAMPAIGN"
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.infobip.com/sms/2/text/advanced");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("accept", "application/json");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"bulkId": "BULK-ID-123-xyz",
"trackingProcessKey": "9243E3F4BEDC719D83C2A38A483E6CB3",
"messages": [
{
"to": "41793026727",
"status": {
"groupId": 1,
"groupName": "PENDING",
"id": 26,
"name": "PENDING_ACCEPTED",
"description": "Message sent to next instance"
},
"messageId": "MESSAGE-ID-123-xyz"
},
{
"to": "41793026731",
"status": {
"groupId": 1,
"groupName": "PENDING",
"id": 26,
"name": "PENDING_ACCEPTED",
"description": "Message sent to next instance"
},
"messageId": "2033912860760522207"
},
{
"to": "41793026785",
"status": {
"groupId": 1,
"groupName": "PENDING",
"id": 26,
"name": "PENDING_ACCEPTED",
"description": "Pending Accepted"
},
"messageId": "2033912860760522208"
}
]
}
HTTP/1.1 200 OK
Content-Type: application/xml
<smsResponse>
<bulkId>BULK-ID-123-xyz</bulkId>
<trackingProcessKey>9243E3F4BEDC719D83C2A38A483E6CB3</trackingProcessKey>
<messages>
<message>
<to>41793026727</to>
<status>
<groupId>1</groupId>
<groupName>PENDING</groupName>
<id>26</id>
<name>PENDING_ACCEPTED</name>
<description>Message sent to next instance</description>
</status>
<messageId>MESSAGE-ID-123-xyz</messageId>
</message>
<message>
<to>41793026731</to>
<status>
<groupId>1</groupId>
<groupName>PENDING</groupName>
<id>26</id>
<name>PENDING_ACCEPTED</name>
<description>Message sent to next instance</description>
</status>
<messageId>2033913391610523177</messageId>
</message>
<message>
<to>41793026785</to>
<status>
<groupId>1</groupId>
<groupName>PENDING</groupName>
<id>26</id>
<name>PENDING_ACCEPTED</name>
<description>Pending Accepted</description>
</status>
<messageId>2033913391620523178</messageId>
</message>
</messages>
</smsResponse>
Response format
If successful, the response header HTTP status code will be 200 OK
and the message will be sent.
If you try to send the message without authorization, you will receive a 401 Unauthorized
error.
Additionally you should also handle the 400 Bad request
status. For more info on HTTP status handling see dedicated section in Integration best practices page.
SMSResponse
Parameter | Type | Description |
---|---|---|
bulkId | String | The ID that uniquely identifies the request. Bulk ID will be received only when a message is sent to more than one destination address. |
messages | SMSResponseDetails | Array of sent message objects, one object per every message. |
SMSResponseDetails
Parameter | Type | Description |
---|---|---|
to | String | The message destination address. |
status | Status | Indicates whether the message is sent successfully, not sent, delivered, not delivered, waiting for delivery or any other possible status. |
messageId | String | The ID that uniquely identifies the sent message. |
Status
Parameter | Type | Description |
---|---|---|
groupId | int | Status group ID. |
groupName | String | Status group name. |
id | int | Status ID. |
name | String | Status name. |
description | String | Human-readable description of the status. |
action | String | Action that should be taken to eliminate the error. |
SMS status
When sending SMS messages, Infobip API will first perform basic validation of the request. If validation passes API will return a response with a status from the PENDING
group (group id 1) and continue processing of the SMS asynchronously. With each request you can define a notifyUrl
. There you will receive the SMS status report. For more details, see the documentation. Alternatively, you can check the delivery status of your message using the Get delivery reports API endpoint. You can find a complete list of SMS statuses at Response status and error codes documentation page.
Fully-featured textual message tutorials:
- Custom bulk id and message id
- SMS transliteration
- SMS language
- Flash SMS
- Schedule SMS and Validity period
- Intermediate delivery reports
- Delivery reports on Notify URL
- SMS tracking solution
- URL shortening & tracking solution
V1 documentation
Documentation for the previous version of API endpoint, still available at /sms/1/text/advanced, can be found here.