{"_id":"57c9ec8b52efd40e00e75f5c","__v":2,"category":{"_id":"56a632277ef6620d00e2f18a","pages":[],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-01-25T14:33:11.835Z","from_sync":false,"order":14,"slug":"text2speech-voice-messaging","title":"Voice Messaging"},"user":"5666f1e966debc1700503eae","parentDoc":null,"project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-02T21:18:03.131Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"json","code":"POST /tts/3/multi HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{  \n   \"messages\":[  \n      {  \n         \"from\":\"12345\",\n         \"to\":[  \n            \"41793026727\",\n            \"41793026731\"\n         ],\n         \"audioFileUrl\": \"http://www.example.com/media.mp3\"\n      },\n      {  \n         \"from\":\"98765\",\n         \"to\": [\"41793026785\"],\n         \"text\": \"Hello world!\",\n         \"language\": \"en\"\n      }\n   ]\n}","name":""},{"code":"curl -X POST \\\n  -H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Accept: application/json\" \\\n  -d '{  \n   \"messages\":[  \n      {  \n         \"from\":\"12345\",\n         \"to\":[  \n            \"41793026727\",\n            \"41793026731\"\n         ],\n         \"audioFileUrl\": \"http://www.example.com/media.mp3\"\n      },\n      {  \n         \"from\":\"98765\",\n         \"to\": [\"41793026785\"],\n         \"text\": \"Hello world!\",\n         \"language\": \"en\"\n      }\n   ]\n}' \"http://api.infobip.com/tts/3/multi\"","name":"cURL","language":"text"},{"name":"PHP","language":"text","code":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"http://api.infobip.com/tts/3/multi\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => \"{ \\n \\\"messages\\\":[ \\n { \\n \\\"from\\\":\\\"12345\\\",\\n \\\"to\\\":[ \\n \\\"41793026727\\\",\\n \\\"41793026731\\\"\\n ],\\n \\\"audioFileUrl\\\": \\\"http://www.example.com/media.mp3\\\"\\n },\\n { \\n \\\"from\\\":\\\"98765\\\",\\n \\\"to\\\": [\\\"41793026785\\\"],\\n \\\"text\\\": \\\"Hello world!\\\",\\n \\\"language\\\": \\\"en\\\"\\n }\\n ]\\n}\",\n  CURLOPT_HTTPHEADER => array(\n    \"accept: application/json\",\n    \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    \"content-type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"name":"Ruby","language":"text","code":"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://api.infobip.com/tts/3/multi\")\n\nhttp = Net::HTTP.new(url.host, url.port)\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"content-type\"] = 'application/json'\nrequest[\"accept\"] = 'application/json'\nrequest.body = \"{ \\n \\\"messages\\\":[ \\n { \\n \\\"from\\\":\\\"12345\\\",\\n \\\"to\\\":[ \\n \\\"41793026727\\\",\\n \\\"41793026731\\\"\\n ],\\n \\\"audioFileUrl\\\": \\\"http://www.example.com/media.mp3\\\"\\n },\\n { \\n \\\"from\\\":\\\"98765\\\",\\n \\\"to\\\": [\\\"41793026785\\\"],\\n \\\"text\\\": \\\"Hello world!\\\",\\n \\\"language\\\": \\\"en\\\"\\n }\\n ]\\n}\"\n\nresponse = http.request(request)\nputs response.read_body"},{"name":"Python","language":"text","code":"import http.client\n\nconn = http.client.HTTPConnection(\"api.infobip.com\")\n\npayload = \"{ \\n \\\"messages\\\":[ \\n { \\n \\\"from\\\":\\\"12345\\\",\\n \\\"to\\\":[ \\n \\\"41793026727\\\",\\n \\\"41793026731\\\"\\n ],\\n \\\"audioFileUrl\\\": \\\"http://www.example.com/media.mp3\\\"\\n },\\n { \\n \\\"from\\\":\\\"98765\\\",\\n \\\"to\\\": [\\\"41793026785\\\"],\\n \\\"text\\\": \\\"Hello world!\\\",\\n \\\"language\\\": \\\"en\\\"\\n }\\n ]\\n}\"\n\nheaders = {\n    'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    'content-type': \"application/json\",\n    'accept': \"application/json\"\n    }\n\nconn.request(\"POST\", \"/tts/3/multi\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"name":"Java","language":"java","code":"HttpResponse<String> response = Unirest.post(\"http://api.infobip.com/tts/3/multi\")\n  .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n  .header(\"content-type\", \"application/json\")\n  .header(\"accept\", \"application/json\")\n  .body(\"{ \\n \\\"messages\\\":[ \\n { \\n \\\"from\\\":\\\"12345\\\",\\n \\\"to\\\":[ \\n \\\"41793026727\\\",\\n \\\"41793026731\\\"\\n ],\\n \\\"audioFileUrl\\\": \\\"http://www.example.com/media.mp3\\\"\\n },\\n { \\n \\\"from\\\":\\\"98765\\\",\\n \\\"to\\\": [\\\"41793026785\\\"],\\n \\\"text\\\": \\\"Hello world!\\\",\\n \\\"language\\\": \\\"en\\\"\\n }\\n ]\\n}\")\n  .asString();"},{"name":"C#","language":"csharp","code":"var client = new RestClient(\"http://api.infobip.com/tts/3/multi\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"accept\", \"application/json\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nrequest.AddParameter(\"application/json\", \"{\\n \\\"messages\\\":[ \\n { \\n \\\"from\\\":\\\"12345\\\",\\n \\\"to\\\":[ \\n \\\"41793026727\\\",\\n \\\"41793026731\\\"\\n ],\\n \\\"audioFileUrl\\\": \\\"http://www.example.com/media.mp3\\\"\\n },\\n { \\n \\\"from\\\":\\\"98765\\\",\\n \\\"to\\\": [\\\"41793026785\\\"],\\n \\\"text\\\": \\\"Hello world!\\\",\\n \\\"language\\\": \\\"en\\\"\\n }\\n ]\\n}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"},{"name":"JavaScript","language":"javascript","code":"var data = JSON.stringify({\n  \"messages\": [\n    {\n      \"from\": \"12345\",\n      \"to\": [\n        \"41793026727\",\n        \"41793026731\"\n      ],\n      \"audioFileUrl\": \"http://www.example.com/media.mp3\"\n    },\n    {\n      \"from\": \"98765\",\n      \"to\": [\n        \"41793026785\"\n      ],\n      \"text\": \"Hello world!\",\n      \"language\": \"en\"\n    }\n  ]\n});\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === 4) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"http://api.infobip.com/tts/3/multi\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\n\nxhr.send(data);"}]},"method":"post","results":{"codes":[{"status":200,"language":"json","code":"{\n  \"bulkId\":\"5028e2d42f19-42f1-4656-351e-a42c191e5fd2\",\n  \"messages\": [\n    {\n      \"to\": \"41793026727\",\n      \"status\": {\n        \"groupId\": 1,\n        \"groupName\": \"PENDING\",\n        \"id\": 26,\n        \"name\": \"PENDING_ACCEPTED\",\n        \"description\": \"Message accepted, pending for delivery.\"\n      },\n      \"messageId\":\"4242f196ba50-a356-2f91-831c4aa55f351ed2\"\n    },\n    {\n      \"to\": \"41793026731\",\n      \"status\": {\n        \"groupId\": 1,\n        \"groupName\": \"PENDING\",\n        \"id\": 26,\n        \"name\": \"PENDING_ACCEPTED\",\n        \"description\": \"Message accepted, pending for delivery.\"\n      },\n      \"messageId\":\"5f35f896ba50-a356-43a4-91cd81b85f8c689\"\n    },\n    {\n      \"to\": \"41793026785\",\n      \"status\": {\n        \"groupId\": 1,\n        \"groupName\": \"PENDING\",\n        \"id\": 26,\n        \"name\": \"PENDING_ACCEPTED\",\n        \"description\": \"Message accepted, pending for delivery.\"\n      },\n      \"messageId\":\"5f35f87a2f19-a141-43a4-91cd81b85f8c689\"\n    }\n  ]\n}","name":""}]},"settings":"554860d6d2c8410d006c215e","auth":"required","params":[{"_id":"55156711bc466623002afe91","ref":"","in":"body","required":false,"desc":"Numeric sender ID length should be between 3 and 14 characters.","default":"","type":"string","name":"from"},{"_id":"55156711bc466623002afe90","ref":"","in":"body","required":true,"desc":"Array of message destination addresses. Destination address must be written in the international format (Example: 41793026727).","default":"","type":"array_string","name":"to"},{"_id":"55156711bc466623002afe8f","ref":"","in":"body","required":false,"desc":"Text of the message that will be sent.","default":"","type":"string","name":"text"},{"_id":"57c9f21052efd40e00e75f66","ref":"","in":"body","required":false,"desc":"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.","default":"en","type":"string","name":"language"},{"_id":"57c9f21052efd40e00e75f65","ref":"","in":"body","required":false,"desc":"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.","default":"","type":"string","name":"audioFileUrl"}],"url":"/tts/3/multi"},"isReference":true,"order":11,"body":"# Response format\n\nIf successful, response header HTTP status code will be `200 OK` and the message will be sent.\n\nIf you try to send the message without authorization, you will receive an  `401 Unauthorized` error.\n\n## VoiceResponse\n\n|Parameter|Type|Description|\n|-|-|-|\n|*bulkId*|String|The ID that uniquely identifies the request. Bulk ID will be received when you send a message to more than one destination address.|\n|*messages*|[VoiceResponseDetails[]](#section-voiceresponsedetails)|Array of sent message objects, one object per every message.|\n\n### VoiceResponseDetails\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|String|The message destination address.|\n|*status*|[Status](#section-status)|Indicates whether the message has been successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.|\n|*messageId*|String|The ID that uniquely identifies the message sent.|\n\n#### Status\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.|","excerpt":"This method allows you to send multiple voice messages to one or more destination addresses.","slug":"multiple-voice-messages","type":"endpoint","title":"Multiple voice messages"}

postMultiple voice messages

This method allows you to send multiple voice messages to one or more destination addresses.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

from:
string
Numeric sender ID length should be between 3 and 14 characters.
to:
required
array of strings
Array of message destination addresses. Destination address must be written in the international format (Example: 41793026727).
text:
string
Text of the message that will be sent.
language:
stringen
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.

Examples


Result Format


Documentation

# Response format If successful, 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 an `401 Unauthorized` error. ## VoiceResponse |Parameter|Type|Description| |-|-|-| |*bulkId*|String|The ID that uniquely identifies the request. Bulk ID will be received when you send a message to more than one destination address.| |*messages*|[VoiceResponseDetails[]](#section-voiceresponsedetails)|Array of sent message objects, one object per every message.| ### VoiceResponseDetails |Parameter|Type|Description| |-|-|-| |*to*|String|The message destination address.| |*status*|[Status](#section-status)|Indicates whether the message has been successfully sent, not sent, delivered, not delivered, waiting for delivery or any other possible status.| |*messageId*|String|The ID that uniquely identifies the message sent.| #### Status |Parameter|Type|Description| |-|-|-| |*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.|