Fully featured voice messages

This method allows you to send advanced voice messages with all the available features and parameters.

Resource

https://api.infobip.com/tts/3/advanced

Parameters

Property name Type Description
bulkId string The ID which uniquely identifies the request.
from string 12345 Numeric sender ID length should be between 3 and 14 characters.
to* array_string Array of message destination addresses. Destination address must be in the international format (Example: 41793026727).
messageId string The ID that uniquely identifies the message sent.
text string Text of the message that will be sent. Pause between words is possible.
language string (en) If the message is in text format, language in which the message is written must be defined for correct pronunciation. Below, in the Languages section, you can find the list of languages that we support.
audioFileUrl string Besides the text format of the message, audio recording (in waw or mp3 format) can also be delivered as a voice message to the recipient. Audio file must be uploaded online so the existing URL can be available for the file download. Size of the audio file must be below 4 MB.
speechRate double (1) The reproduction speed of speech in the resulting message. Effective only when using text. Supported range is from 0.5 (slow down speech) to 2 (speed up speech). Values less than 0.5 will be replaced with 0.5, and values higher than 2 will be replaced with 2.
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.
validityPeriod int The message validity period shown in minutes. When the period expires, it will not be allowed for the message to be sent. A validity period longer than 48h is not supported (in this case, it will be automatically set to 48h).
sendAt datetime Used for scheduled Voice messages (message not to be sent immediately, but at scheduled time).
record boolean Record the call and expose it to client as URL inside the delivery report. Can be true or false.
repeatDtmf string Response (DTMF) code which enables repeating message if a subscriber enters it.
maxDtmf int int(0) Defines the max number of dtmf codes entered by end user that would be received.
ringTimeout int (45) The duration of the call prior to answer shown in seconds, unless there are no operator limitations.
dtmfTimeout int (10) The waiting period for end user to enter dtmf digits.
callTimeout int Total call period shown in seconds.
machineDetection string (disable) This action attempts to detect answering machines at the beginning of the call. Possible values: disablehangup.
callTransfers array_object Possible call transfer scenario defined as JSON object. See example below
track string Indicates if the message has to be tracked for Conversion rates. Possible values: VOICE.
processKey string Key that uniquely identifies Conversion tracking process.
callbackData string Additional client's data that will be sent on the notifyUrl. The maximum value is 200 characters.
pause int (0) Indicating period of time in seconds between end user answering the call and message starting to be played. Minimal value is 0 and maximum value is 10 seconds.
retry object Used to define if the delivery of the Voice messages should be retried in case the first try doesn't succeed. Additional retries will be made according to the schedule defined by minPeriod and maxPeriod parameters and platform's internal retry logic. If the minPeriod differs maxPeriod, delivery will be retried in the following manner: after 1 min, 2 min, 5 min, 10 min, 20 min, 30 min, 1 hour, 2 hours, 4 hours, 8 hours, 16 hours, 24 hours or until maxPeriod is reached.  If the retry attempt for the MaxPeriod is reached, the MaxPeriod will be used for all subsequent retries. If the minPeriod and the maxPeriod are defined as equal values, the period of time between retries will be equal to this value. Message delivery will be retried until the successful delivery or message validity or maxCount value is reached.
minPeriod int Defines the minimal waiting time (in minutes) after the previous failed attempt to try to deliver the message again.
maxPeriod int Defines the maximum waiting time (in minutes) after the previous failed attempt to try to deliver the message again.
maxCount int Specify the maximum number of retry attempts. Maximum value of the maxCount is 4. Higher value, if entered will be set to 4.
sendingSpeed object Sending rate defined in number of messages sent per second, minute, hour or day. First message will be sent immediately (or at sendAt time if scheduling is used) and subsequent messages will be sent respecting defined speed. For example, if sendingSpeed is defined as 10 messages per hour, messages will be sent every 6 minutes. If this parameter is defined, validityPeriod is ignored.
speed int Defines the number of messages that will be sent per specified time unit.
timeUnit string Defines time unit used for calculating sending speed.  Possible values: second, minute, hour and day.

Request Example

					POST /tts/3/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
   "bulkId": "BULK-ID-123-xyz",
   "messages": [
      {
         "from": "41793026700",
         "destinations": [
            {
               "to": "41793026727",
               "messageId": "MESSAGE-ID-123-xyz"
            },
            {
               "to": "41793026731"
            }
         ],
         "text": "Test Voice message.",
         "language": "en",
         "speechRate": 1,
         "notifyUrl": "https://www.example.com/voice/advanced",
         "notifyContentType": "application/json",
         "callbackData":"DLR callback data",
         "validityPeriod": 720,
         "sendAt": "2016-07-07T17:00:00.000+01:00",
         "record": false,
         "repeatDtmf": "123#",
         "maxDtmf":1,
         "ringTimeout": 45,
         "dtmfTimeout": 10,
         "callTimeout": 130,
         "machineDetection": "DISABLE",
         "pause": 3,
         "retry": {
            "minPeriod":1,
           	"maxPeriod": 5,
            "maxCount":5
         }
      },
      {
         "from": "41793026700",
         "destinations": [
            {
               "to": "41793026785"
            }
         ],
         "text": "A long time ago, in a galaxy far.",
         "sendAt": "2016-07-07T18:00:00.000+01:00"
      }
   ],
   "tracking":{
         "track": "VOICE",
         "type": "MY_CAMPAIGN"
   }
}
					
				
					curl -X POST \
-H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
   "bulkId":"BULK-ID-123-xyz",
   "messages":[
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026727",
               "messageId":"MESSAGE-ID-123-xyz"
            },
            {
               "to":"41793026731"
            }
         ],
         "text": "Test Voice message.",
         "language": "en",
         "speechRate":1,
         "notifyUrl":"https://www.example.com/voice/advanced",
         "notifyContentType":"application/json",
         "validityPeriod": 720,
         "sendAt":"2016-07-07T17:00:00.000+01:00",
         "record": false,
         "repeatDtmf": "123#",
         "maxDtmf": 1
         "ringTimeout": 45,
         "dtmfTimeout": 10,
         "callTimeout": 130,
         "machineDetection": "DISABLE",
         "pause": 3,
         "retry": {
            "minPeriod":1,
           	"maxPeriod": 5,
            "maxCount":5
            }
      },
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026785"
            }
         ],
         "text":"A long time ago, in a galaxy far.",
         "sendAt":"2016-07-07T18:00:00.000+01:00"
      }
   ]
}' "https://api.infobip.com/tts/3/advanced"
					
				
					<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/tts/3/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 => "{ 
                          \"bulkId\": \"BULK-ID-123-xyz\",
                          \"messages\": [
                            {
                              \"from\": \"41793026700\",
                              \"destinations\": [
                                {
                                  \"to\": \"41793026727\",
                                  \"messageId\": \"MESSAGE-ID-123-xyz\"
                                },
                                {
                                  \"to\": \"41793026731\"
                                }
                              ],
                              \"text\": \"Test Voice message.\",
                              \"language\": \"en\",
                              \"speechRate\": 1,
                              \"notifyUrl\": \"https://www.example.com/voice/advanced\",
                              \"notifyContentType\": \"application/json\",
                              \"validityPeriod\": 720,
                              \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                              \"record\": false,
                              \"repeatDtmf\": \"123#\",
                              \"maxDtmf\": 1,
                              \"ringTimeout\": 45,
                              \"dtmfTimeout\": 10,
                              \"callTimeout\": 130,
                              \"machineDetection\": \"DISABLE\",
                              \"pause\": 3,
                              \"retry\": {
                                  \"minPeriod\": 1,
           												\"maxPeriod\": 5,
            											\"maxCount\": 5
                                }
                            },
                            {
                              \"from\": \"41793026700\",
                              \"destinations\": [
                                {
                                  \"to\": \"41793026785\"
                                }
                              ],
                              \"text\": \"A long time ago, in a galaxy far.\",
                              \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
                            }
                          ]
                        }",
  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/tts/3/advanced")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{ 
                \"bulkId\": \"BULK-ID-123-xyz\",
                \"messages\": [
                  {
                    \"from\": \"41793026700\",
                    \"destinations\": [
                      {
                        \"to\": \"41793026727\",
                        \"messageId\": \"MESSAGE-ID-123-xyz\"
                      },
                      {
                        \"to\": \"41793026731\"
                      }
                    ],
                    \"text\": \"Test Voice message.\",
                    \"language\": \"en\",
                    \"speechRate\": 1,
                    \"notifyUrl\": \"https://www.example.com/voice/advanced\",
                    \"notifyContentType\": \"application/json\",
                    \"validityPeriod\": 720,
                    \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                    \"record\": false,
                    \"repeatDtmf\": \"123#\",
 										\"maxDtmf\": 1,
                    \"ringTimeout\": 45,
                    \"dtmfTimeout\": 10,
                    \"callTimeout\": 130,
                    \"machineDetection\": \"DISABLE\",
										\"pause\": 3,
        						\"retry\": {
                      \"minPeriod\": 1,
           						\"maxPeriod\": 5,
            					\"maxCount\": 5
                      }
                  },
                  {
                    \"from\": \"41793026700\",
                    \"destinations\": [
                      {
                        \"to\": \"41793026785\"
                      }
                    ],
                    \"text\": \"A long time ago, in a galaxy far.\",
                    \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
                  }
                ]
              }",

response = http.request(request)
puts response.read_body
					
				
					import http.client

conn = http.client.HTTPSConnection("api.infobip.com")

payload = "{ 
            \"bulkId\": \"BULK-ID-123-xyz\",
            \"messages\": [
              {
                \"from\": \"41793026700\",
                \"destinations\": [
                  {
                    \"to\": \"41793026727\",
                    \"messageId\": \"MESSAGE-ID-123-xyz\"
                  },
                  {
                    \"to\": \"41793026731\"
                  }
                ],
                \"text\": \"Test Voice message.\",
                \"language\": \"en\",
                \"speechRate\": 1,
                \"notifyUrl\": \"https://www.example.com/voice/advanced\",
                \"notifyContentType\": \"application/json\",
                \"validityPeriod\": 720,
                \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                \"record\": false,
                \"repeatDtmf\": \"123#\",
             		\"maxDtmf\": 1,
                \"ringTimeout\": 45,
                \"dtmfTimeout\": 10,
                \"callTimeout\": 130,
                \"machineDetection\": \"DISABLE\",
            		\"pause\": 3,
            		\"retry\": {
                		\"minPeriod\": 1,
           					\"maxPeriod\": 5,
            				\"maxCount\": 5
                	}
              },
              {
                \"from\": \"41793026700\",
                \"destinations\": [
                  {
                    \"to\": \"41793026785\"
                  }
                ],
                \"text\": \"A long time ago, in a galaxy far.\",
                \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
              }
            ]
          }"

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("POST", "/tts/3/advanced", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
					
				
					HttpResponse<String> response = Unirest.post("https://api.infobip.com/tts/3/advanced")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{ 
          \"bulkId\": \"BULK-ID-123-xyz\",
          \"messages\": [
            {
              \"from\": \"41793026700\",
              \"destinations\": [
                {
                  \"to\": \"41793026727\",
                  \"messageId\": \"MESSAGE-ID-123-xyz\"
                },
                {
                  \"to\": \"41793026731\"
                }
              ],
              \"text\": \"Test Voice message.\",
              \"language\": \"en\",
              \"speechRate\": 1,
              \"notifyUrl\": \"https://www.example.com/voice/advanced\",
              \"notifyContentType\": \"application/json\",
              \"validityPeriod\": 720,
              \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
              \"record\": false,
              \"repeatDtmf\": \"123#\",
              \"maxDtmf\": 1,
              \"ringTimeout\": 45,
              \"dtmfTimeout\": 10,
              \"callTimeout\": 130,
              \"machineDetection\": \"DISABLE\",
              \"pause\": 3,
              \"retry\": {
              		\"minPeriod\": 1,
           				\"maxPeriod\": 5,
            			\"maxCount\": 5
                }
            },
            {
              \"from\": \"41793026700\",
              \"destinations\": [
                {
                  \"to\": \"41793026785\"
                }
              ],
              \"text\": \"A long time ago, in a galaxy far.\",
              \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
            }
          ]
        }")
  .asString();
					
				
					var client = new RestClient("https://api.infobip.com/tts/3/advanced");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
request.AddParameter("application/json", 
                     "{ 
                       \"bulkId\": \"BULK-ID-123-xyz\",
                       \"messages\": [
                       {
                         \"from\": \"41793026700\",
                           \"destinations\": [
                         {
                           \"to\": \"41793026727\",
                             \"messageId\": \"MESSAGE-ID-123-xyz\"
                         },
                         {
                           \"to\": \"41793026731\"
                         }
                         ],
                         \"text\": \"Test Voice message.\",
                           \"language\": \"en\",
                           \"speechRate\": 1,
                           \"notifyUrl\": \"https://www.example.com/voice/advanced\",
                           \"notifyContentType\": \"application/json\",
                           \"validityPeriod\": 720,
                           \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                           \"record\": false,
                           \"repeatDtmf\": \"123#\",
                           \"maxDtmf\": 1,
                           \"ringTimeout\": 45,
                           \"dtmfTimeout\": 10,
                           \"callTimeout\": 130,
                           \"machineDetection\": \"DISABLE\",
                           \"pause\": 3,
                           \"retry\": {
              									\"minPeriod\": 1,
           											\"maxPeriod\": 5,
            										\"maxCount\": 5
                							}
                       },
                       {
                         \"from\": \"41793026700\",
                           \"destinations\": [
                         {
                           \"to\": \"41793026785\"
                         }
                         ],
                         \"text\": \"A long time ago, in a galaxy far.\",
                           \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
                       }
                       ]
                       }", 
                     ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
					
				
					var data = JSON.stringify({
  "bulkId": "BULK-ID-123-xyz",
  "messages": [
    {
      "from": "41793026700",
      "destinations": [
        { 
          "to": "41793026727",
          "messageId": "MESSAGE-ID-123-xyz"
        },
        {
          "to": "41793026731"
        }
      ],
      "text": "Test Voice message.",
      "language": "en",
      "speechRate": 1,
      "notifyUrl": "https://www.example.com/voice/advanced",
      "notifyContentType": "application/json",
      "validityPeriod": 720,
      "sendAt": "2016-07-07T17:00:00.000+01:00",
      "record": false,
      "repeatDtmf": "123#",
      "repeatDtmf": 1,
      "ringTimeout": 45,
      "dtmfTimeout": 10,
      "callTimeout": 130,
      "machineDetection": "DISABLE",
      "pause": 3,
      "retry": {
            "minPeriod":1,
           	"maxPeriod": 5,
            "maxCount":5
         }
    },
    {
      "from": "41793026700",
      "destinations": [
        {
          "to": "41793026785"
        }
      ],
      "text": "A long time ago, in a galaxy far.",
      "sendAt": "2016-07-07T18:00:00.000+01:00"
    }
  ]
});

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/tts/3/advanced");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);
					
				

Response

					{
  "bulkId": "BULK-ID-123-xyz",
  "messages": [
    {
      "to": "41793026727",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId": "MESSAGE-ID-123-xyz"
    },
    {
      "to": "41793026731",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId":"9304a5a3ab19-1ca1-be74-76ad87651ed25f35"
    },
    {
      "to": "41793026785",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId":"5f35f87a2f19-a141-43a4-91cd81b85f8c689"
    }
  ]
}
					
				

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.

VoiceResponse

Parameter Type Description
bulkId String The ID that uniquely identifies the request. Bulk ID will be received when a message is sent to more than one destination address.
messages VoiceResponseDetails Array of sent message objects, one object per every message.

VoiceResponseDetails

Parameter Type Description
to String The message destination address.
status Status Indicates whether the message has been 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.

Pause between words

Adding pauses between the words and extending the duration of the voice message is possible by using the comma character “,”.

For example, if you want to have a 3 second pause after each word, then the text parameter should look like this “one,,,,,,two,,,,,,three,,,,,,”. Each coma creates a pause of 0,5 seconds.

Ring timeout limitations

There are no limitations on the Voice platform regarding this value, however, most of the operators have their own ring timeout limitations and it is advisable to keep the ringTimeout value up to 45s.

What is Answering Machine Detection (AMD)?

This is an attempt (without guarantee) of detecting an answering machine based upon patterns in an audio stream after receiving an answer signal from the operator. Activities can be defined by setting one of two possible values: disable, hang up.

Disable (default value)

This is the default value in case the parameter machineDetection is not set in the API request. This value represents no usage of AMD option, and during the call there won’t be any attempts in detecting an answering machine.

Hangup

If the parameter machineDetection is set to hangup, the Voice platform will try to detect an answering machine, and in case it detects one, the call will be hung up immediately.

Call Transfers

Using call transfer, you can send an interactive message to your subscribers, providing them the opportunity to respond by pressing their phone keys. When your subscriber chooses a number call transfer will redirect a call to the set number. The Field is JSON formatted.

Call transfer for any DTMF

[
  {
    "if": "anyDtmf",
    "transferTo": "79029555525"
  }
]

Call transfer for specific DTMF

[
    { 
        "if": "dtmf",
        "equals": "1",
        "transferTo": "79029555525"
    },
    { 
        "if": "dtmf",
        "equals": "2",
        "transferTo": "79029555551"
    }
]

Request example

POST /tts/3/advanced HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json

{
   "bulkId":"BULK-ID-123-xyz",
   "messages":[
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026727",
               "messageId":"MESSAGE-ID-123-xyz"
            },
            {
               "to":"41793026731"
            }
         ],
         "text": "Test Voice message.",
         "language": "en",
         "speechRate":1,
         "notifyUrl":"http://www.example.com/voice/advanced",
         "notifyContentType":"application/json",
         "validityPeriod": 720,
         "sendAt":"2016-07-07T17:00:00.000+01:00",
         "record": false,
         "repeatDtmf": "123#",
         "maxDtmf":1,
         "ringTimeout": 45,
         "dtmfTimeout": 10,
         "callTimeout": 130,
         "machineDetection": "DISABLE",
         "pause":3,
         "retry": {
            "minPeriod":1,
            "maxPeriod": 5,
            "maxCount":5
                },
         "callTransfers": [
          {
            "if": "dtmf",
            "equals": "1",
            "transferTo": "79029555525"
          },
          {
            "if": "dtmf",
            "equals": "2",
            "transferTo": "79029555551"
          }
         ]
         
      },
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026785"
            }
         ],
         "text":"A long time ago, in a galaxy far.",
         "sendAt":"2016-07-07T18:00:00.000+01:00"
      }
   ]
}
curl -X POST \
-H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
   "bulkId":"BULK-ID-123-xyz",
   "messages":[
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026727",
               "messageId":"MESSAGE-ID-123-xyz"
            },
            {
               "to":"41793026731"
            }
         ],
         "text": "Test Voice message.",
         "language": "en",
         "speechRate":1,
         "notifyUrl":"http://www.example.com/voice/advanced",
         "notifyContentType":"application/json",
         "validityPeriod": 720,
         "sendAt":"2016-07-07T17:00:00.000+01:00",
         "record": false,
         "repeatDtmf": "123#",
         "maxDtmf":1,
         "ringTimeout": 45,
         "dtmfTimeout": 10,
         "callTimeout": 130,
         "machineDetection": "DISABLE",
         "pause": 3,
         "retry": {
            "minPeriod":1,
            "maxPeriod": 5,
            "maxCount":5
            },
         "callTransfers": [
            {
               "if": "dtmf",
               "equals": "1",
               "transferTo": "79029555525"
            },
            {
               "if": "dtmf",
               "equals": "2",
               "transferTo": "79029555551"
            }
         ]
      },
      {
         "from":"41793026700",
         "destinations":[
            {
               "to":"41793026785"
            }
         ],
         "text":"A long time ago, in a galaxy far.",
         "sendAt":"2016-07-07T18:00:00.000+01:00"
      }
   ]
}' "http://api.infobip.com/tts/3/advanced"
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.infobip.com/tts/3/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 => "{ 
                          \"bulkId\": \"BULK-ID-123-xyz\",
                          \"messages\": [
                            {
                              \"from\": \"41793026700\",
                              \"destinations\": [
                                {
                                  \"to\": \"41793026727\",
                                  \"messageId\": \"MESSAGE-ID-123-xyz\"
                                },
                                {
                                  \"to\": \"41793026731\"
                                }
                              ],
                              \"text\": \"Test Voice message.\",
                              \"language\": \"en\",
                              \"speechRate\": 1,
                              \"notifyUrl\": \"http://www.example.com/voice/advanced\",
                              \"notifyContentType\": \"application/json\",
                              \"validityPeriod\": 720,
                              \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                              \"record\": false,
                              \"repeatDtmf\": \"123#\",
                              \"maxDtmf\": \"1\",
                              \"ringTimeout\": 45,
                              \"dtmfTimeout\": 10,
                              \"callTimeout\": 130,
                              \"machineDetection\": \"DISABLE\",
                              \"pause\": 3,
                              \"retry\": {
                                  \"minPeriod\": 1,
                                                        \"maxPeriod\": 5,
                                                        \"maxCount\": 5
                                },
                              \"callTransfers\": [
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"1\",
                                  \"transferTo\": \"79029555525\"
                                },
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"2\",
                                  \"transferTo\": \"79029555551\"
                                }
                              ]
                            },
                            {
                              \"from\": \"41793026700\",
                              \"destinations\": [
                                {
                                  \"to\": \"41793026785\"
                                }
                              ],
                              \"text\": \"A long time ago, in a galaxy far.\",
                              \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
                            }
                          ]
                        }",
  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("http://api.infobip.com/tts/3/advanced")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{ 
                \"bulkId\": \"BULK-ID-123-xyz\",
                \"messages\": [
                  {
                    \"from\": \"41793026700\",
                    \"destinations\": [
                      {
                        \"to\": \"41793026727\",
                        \"messageId\": \"MESSAGE-ID-123-xyz\"
                      },
                      {
                        \"to\": \"41793026731\"
                      }
                    ],
                    \"text\": \"Test Voice message.\",
                    \"language\": \"en\",
                    \"speechRate\": 1,
                    \"notifyUrl\": \"http://www.example.com/voice/advanced\",
                    \"notifyContentType\": \"application/json\",
                    \"validityPeriod\": 720,
                    \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                    \"record\": false,
                    \"repeatDtmf\": \"123#\",
                    \"maxDtmf\": \"1\",
                    \"ringTimeout\": 45,
                    \"dtmfTimeout\": 10,
                    \"callTimeout\": 130,
                    \"machineDetection\": \"DISABLE\",
                                        \"pause\": 3,
                                        \"retry\": {
                        \"minPeriod\": 1,
                                    \"maxPeriod\": 5,
                                    \"maxCount\": 5
                        },
                    \"callTransfers\": [
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"1\",
                                  \"transferTo\": \"79029555525\"
                                },
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"2\",
                                  \"transferTo\": \"79029555551\"
                                }
                              ]
                  },
                  {
                    \"from\": \"41793026700\",
                    \"destinations\": [
                      {
                        \"to\": \"41793026785\"
                      }
                    ],
                    \"text\": \"A long time ago, in a galaxy far.\",
                    \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
                  }
                ]
              }"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPConnection("api.infobip.com")

payload = "{ 
            \"bulkId\": \"BULK-ID-123-xyz\",
            \"messages\": [
              {
                \"from\": \"41793026700\",
                \"destinations\": [
                  {
                    \"to\": \"41793026727\",
                    \"messageId\": \"MESSAGE-ID-123-xyz\"
                  },
                  {
                    \"to\": \"41793026731\"
                  }
                ],
                \"text\": \"Test Voice message.\",
                \"language\": \"en\",
                \"speechRate\": 1,
                \"notifyUrl\": \"http://www.example.com/voice/advanced\",
                \"notifyContentType\": \"application/json\",
                \"validityPeriod\": 720,
                \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                \"record\": false,
                \"repeatDtmf\": \"123#\",
                \"maxDtmf\": \"1\",
                \"ringTimeout\": 45,
                \"dtmfTimeout\": 10,
                \"callTimeout\": 130,
                \"machineDetection\": \"DISABLE\",
                    \"pause\": 3,
                    \"retry\": {
                        \"minPeriod\": 1,
                                    \"maxPeriod\": 5,
                                    \"maxCount\": 5
                        },
                \"callTransfers\": [
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"1\",
                                  \"transferTo\": \"79029555525\"
                                },
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"2\",
                                  \"transferTo\": \"79029555551\"
                                }
                              ]
              },
              {
                \"from\": \"41793026700\",
                \"destinations\": [
                  {
                    \"to\": \"41793026785\"
                  }
                ],
                \"text\": \"A long time ago, in a galaxy far.\",
                \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
              }
            ]
          }"

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("POST", "/tts/3/advanced", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.post("http://api.infobip.com/tts/3/advanced")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{ 
          \"bulkId\": \"BULK-ID-123-xyz\",
          \"messages\": [
            {
              \"from\": \"41793026700\",
              \"destinations\": [
                {
                  \"to\": \"41793026727\",
                  \"messageId\": \"MESSAGE-ID-123-xyz\"
                },
                {
                  \"to\": \"41793026731\"
                }
              ],
              \"text\": \"Test Voice message.\",
              \"language\": \"en\",
              \"speechRate\": 1,
              \"notifyUrl\": \"http://www.example.com/voice/advanced\",
              \"notifyContentType\": \"application/json\",
              \"validityPeriod\": 720,
              \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
              \"record\": false,
              \"repeatDtmf\": \"123#\",
              \"maxDtmf\": \"1\",
              \"ringTimeout\": 45,
              \"dtmfTimeout\": 10,
              \"callTimeout\": 130,
              \"machineDetection\": \"DISABLE\",
              \"pause\": 3,
              \"retry\": {
                        \"minPeriod\": 1,
                                    \"maxPeriod\": 5,
                                    \"maxCount\": 5
                        },
              \"callTransfers\": [
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"1\",
                                  \"transferTo\": \"79029555525\"
                                },
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"2\",
                                  \"transferTo\": \"79029555551\"
                                }
                              ]
            },
            {
              \"from\": \"41793026700\",
              \"destinations\": [
                {
                  \"to\": \"41793026785\"
                }
              ],
              \"text\": \"A long time ago, in a galaxy far.\",
              \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
            }
          ]
        }")
  .asString();
var client = new RestClient("http://api.infobip.com/tts/3/advanced");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
request.AddParameter("application/json", 
                    "{ 
                      \"bulkId\": \"BULK-ID-123-xyz\",
                      \"messages\": [
                        {
                          \"from\": \"41793026700\",
                          \"destinations\": [
                            {
                              \"to\": \"41793026727\",
                              \"messageId\": \"MESSAGE-ID-123-xyz\"
                            },
                            {
                              \"to\": \"41793026731\"
                            }
                          ],
                          \"text\": \"Test Voice message.\",
                          \"language\": \"en\",
                          \"speechRate\": 1,
                          \"notifyUrl\": \"http://www.example.com/voice/advanced\",
                          \"notifyContentType\": \"application/json\",
                          \"validityPeriod\": 720,
                          \"sendAt\": \"2016-07-07T17:00:00.000+01:00\",
                          \"record\": false,
                          \"repeatDtmf\": \"123#\",
                          \"maxDtmf\": \"1\",
                          \"ringTimeout\": 45,
                          \"dtmfTimeout\": 10,
                          \"callTimeout\": 130,
                          \"machineDetection\": \"DISABLE\",
                          \"pause\": 3,
                          \"retry\": {
                                    \"minPeriod\": 1,
                                                \"maxPeriod\": 5,
                                                \"maxCount\": 5
                                        },
                          \"callTransfers\": [
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"1\",
                                  \"transferTo\": \"79029555525\"
                                },
                                {
                                  \"if\": \"dtmf\",
                                  \"equals\": \"2\",
                                  \"transferTo\": \"79029555551\"
                                }
                              ]
                        },
                        {
                          \"from\": \"41793026700\",
                          \"destinations\": [
                            {
                              \"to\": \"41793026785\"
                            }
                          ],
                          \"text\": \"A long time ago, in a galaxy far.\",
                          \"sendAt\": \"2016-07-07T18:00:00.000+01:00\"
                        }
                      ]
                    }", 
                    ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
var data = JSON.stringify({
  "bulkId": "BULK-ID-123-xyz",
  "messages": [
    {
      "from": "41793026700",
      "destinations": [
        { 
          "to": "41793026727",
          "messageId": "MESSAGE-ID-123-xyz"
        },
        {
          "to": "41793026731"
        }
      ],
      "text": "Test Voice message.",
      "language": "en",
      "speechRate": 1,
      "notifyUrl": "http://www.example.com/voice/advanced",
      "notifyContentType": "application/json",
      "validityPeriod": 720,
      "sendAt": "2016-07-07T17:00:00.000+01:00",
      "record": false,
      "repeatDtmf": "123#",
      "maxDtmf": "1",
      "ringTimeout": 45,
      "dtmfTimeout": 10,
      "callTimeout": 130,
      "machineDetection": "DISABLE",
      "pause": 3,
      "callTransfers": [
          {
            "if": "dtmf",
            "equals": "1",
            "transferTo": "79029555525"
          },
          {
            "if": "dtmf",
            "equals": "2",
            "transferTo": "79029555551"
          }
         ]
      
    },
    {
      "from": "41793026700",
      "destinations": [
        {
          "to": "41793026785"
        }
      ],
      "text": "A long time ago, in a galaxy far.",
      "sendAt": "2016-07-07T18:00:00.000+01:00"
    }
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "http://api.infobip.com/tts/3/advanced");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);

API response

{
  "bulkId": "BULK-ID-123-xyz",
  "messages": [
    {
      "to": "41793026727",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId": "MESSAGE-ID-123-xyz"
    },
    {
      "to": "41793026731",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId":"9304a5a3ab19-1ca1-be74-76ad87651ed25f35"
    },
    {
      "to": "79029555525",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 26,
        "name": "PENDING_ACCEPTED",
        "description": "Message accepted, pending for delivery."
      },
      "messageId":"f0401b7b-5c44-4a62-8a1b-61ec26101ff0"
    }
  ]
}