Test

Resource

https://api.infobip.com/push/2/message/single

URL: https://api.infobip.com

Request Example

					POST /push/2/message/single HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
    "from": "d417d38814740a23f50b5c876e226445-0f700564-abbf-4b5b-beae-86a4ef410904",
    "to": {
        "externalUserId": "customer_21234"
    },
    "text": "This Message was sent by targeting exact externalUserId.",
    "notificationOptions": {
    	"soundEnabled": false,
    	"badge": 1,
      "contentUrl": "https://www.mydomain.com/images/image1.jpg",
      "category": "mm_accept_decline"
    },
	  "customPayload":{
  		"targetUrl": "www.someDomain.com",
	 		"someData": "someData"
	  },
    "validityPeriod": 30,
    "validityPeriodTimeUnit": "MINUTES",
    "notifyUrl": "https://example.com",
    "notifyContentType" : "application/json",
    "callbackData" : "DLR callback data"
}
				
					<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/sms/1/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;
}
				
					HttpResponse<String> response = Unirest.post("https://api.infobip.com/sms/1/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();
				

Sending messages to multiple recipients at once is also supported, as long as they all get the same message. The URL is basically the same as with simple SMS. The only difference is in the to key where you need to separate recipients by a comma.

https://api.infobip.com/sms/1/text/query?username=myUsername&password=myPassword&to=41793026727,41793026834&text=Message text

Closer look:

&to=41793026727,41793026834