{"__v":1,"_id":"57c9e71b35d18d0e002429ed","category":{"__v":0,"_id":"56a632277ef6620d00e2f18a","pages":[],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-01-25T14:33:11.835Z","from_sync":false,"order":10,"slug":"text2speech-voice-messaging","title":"Voice Messaging"},"parentDoc":null,"project":"54eb50e5615ffc1900305a16","user":"5666f1e966debc1700503eae","version":{"__v":20,"_id":"54eb63b859b1172100334fae","forked_from":"54eb63a1867e1917009b711d","project":"54eb50e5615ffc1900305a16","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"],"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-02T20:54:51.571Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"name":"","code":"POST /tts/3/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{\n  \"from\": \"12345\",\n  \"to\": \"41793026727\",\n  \"text\": \"Test Voice message.\",\n  \"language\": \"en\"\n}","language":"json"},{"code":"curl -X POST \\\n-H \"Accept: application/json\" \\\n-H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\" \\\n-H \"Content-Type: application/json\" \\\n-H \"Accept: application/json\" \\\n-d '{\n  \"from\": \"12345\",\n  \"to\": \"41793026727\",\n  \"text\": \"Test Voice message.\",\n  \"language\": \"en\"\n}' \"http://api.infobip.com/tts/3/single\"","language":"curl"},{"code":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => \"http://api.infobip.com/tts/3/single\",\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  \\\"from\\\": \\\"12345\\\",\\n  \\\"to\\\": \\\"41793026727\\\",\\n  \\\"text\\\": \\\"Test Voice message.\\\",\\n  \\\"language\\\": \\\"en\\\"\\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}","language":"php"},{"code":"require 'uri'\nrequire 'net/http'\n\nurl = URI(\"http://api.infobip.com/tts/3/single\")\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[\"cache-control\"] = 'no-cache'\nrequest[\"postman-token\"] = 'feb1ddbf-7c53-9949-7e56-3091808a9e36'\nrequest.body = \"{\\n \\\"from\\\": \\\"12345\\\",\\n  \\\"to\\\": \\\"41793026727\\\",\\n  \\\"text\\\": \\\"Test Voice message.\\\",\\n  \\\"language\\\": \\\"en\\\"\\n}\"\n\nresponse = http.request(request)\nputs response.read_body","language":"ruby"},{"code":"import http.client\n\nconn = http.client.HTTPConnection(\"api.infobip.com\")\n\npayload = \"{\\n  \\\"from\\\": \\\"12345\\\",\\n  \\\"to\\\": \\\"41793026727\\\",\\n  \\\"text\\\": \\\"Test Voice message.\\\",\\n  \\\"language\\\": \\\"en\\\"\\n}\"\n\nheaders = {\n    'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n    'content-type': \"application/json\",\n    'accept': \"application/json\"\n    }\n\nconn.request(\"POST\", \"/tts/3/single\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))","language":"python"},{"code":"HttpResponse<String> response = Unirest.post(\"http://api.infobip.com/tts/3/single\")\n  .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n  .header(\"content-type\", \"application/json\")\n  .header(\"accept\", \"application/json\")\n  .body(\"{\\n  \\\"from\\\": \\\"12345\\\",\\n  \\\"to\\\": \\\"41793026727\\\",\\n  \\\"text\\\": \\\"Test Voice message.\\\",\\n  \\\"language\\\": \\\"en\\\"\\n}\")\n  .asString();","language":"java"},{"code":"var client = new RestClient(\"http://api.infobip.com/tts/3/single\");\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  \\\"from\\\": \\\"12345\\\",\\n  \\\"to\\\": \\\"41793026727\\\",\\n  \\\"text\\\": \\\"Test Voice message.\\\",\\n  \\\"language\\\": \\\"en\\\"\\n}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);","language":"csharp"},{"code":"var data = JSON.stringify({\n  \"from\": \"12345\",\n  \"to\": \"41793026727\",\n  \"text\": \"Test Voice message.\",\n  \"language\": \"en\"\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/single\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\n\nxhr.send(data);","language":"javascript"}]},"method":"post","results":{"codes":[{"name":"OK - JSON","code":"{\n  \"messages\": [\n    {\n      \"to\": \"41793026727\",\n      \"status\": {\n        \"groupId\": 1,\n        \"groupName\": \"PENDING\",\n        \"id\": 7,\n        \"name\": \"PENDING_ENROUTE\",\n        \"description\": \"Message sent to next instance\"\n      },\n      \"messageId\":\"2250be2d4219-3af1-78856-aabe-1362af1edfd2\"\n    }\n  ]\n}","language":"json","status":200}]},"settings":"","auth":"required","params":[{"_id":"566abc7b74d574170070b711","ref":"","in":"body","required":false,"desc":"Numeric sender ID length should be between 3 and 14 characters.","default":"12345","type":"string","name":"from"},{"_id":"566abc7b74d574170070b710","ref":"","in":"body","required":true,"desc":"Destination address must be written in the international format (Example: 41793026727).","default":"","type":"string","name":"to"},{"_id":"566abc7b74d574170070b70f","ref":"","in":"body","required":false,"desc":"Message to be converted to speech and played to subscribers.","default":"","type":"string","name":"text"},{"_id":"566abc7b74d574170070b70d","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":"566abc7b74d574170070b70e","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/single"},"isReference":true,"order":10,"body":"# Response format\n\nOn success, response header HTTP status code will be `200 OK` and the message will be sent.\n\nIf you try to send message without authorization, you will receive the `401 Unauthorized` error .\n\n### VoiceResponse\n\n|Parameter|Type|Description|\n|-|-|-|\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#section-status-object-example).|\n|*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.|\n\n# Languages\n\nList of supported languages:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Language\",\n    \"h-1\": \"Language shortcut\",\n    \"0-0\": \"English\",\n    \"0-1\": \"en\",\n    \"1-0\": \"Spanish\",\n    \"1-1\": \"es\",\n    \"2-0\": \"Catalan\",\n    \"2-1\": \"ca\",\n    \"3-0\": \"Chinese-Simplified\",\n    \"3-1\": \"zh-cn\",\n    \"4-0\": \"Chinese-Traditional\",\n    \"4-1\": \"zh-tw\",\n    \"5-0\": \"Danish\",\n    \"5-1\": \"da\",\n    \"6-0\": \"Dutch\",\n    \"6-1\": \"nl\",\n    \"7-0\": \"French\",\n    \"7-1\": \"fr\",\n    \"8-0\": \"German\",\n    \"8-1\": \"de\",\n    \"9-0\": \"Italian\",\n    \"9-1\": \"it\",\n    \"10-0\": \"Japanese\",\n    \"10-1\": \"ja\",\n    \"11-0\": \"Korean\",\n    \"11-1\": \"ko\",\n    \"12-0\": \"Norwegian\",\n    \"12-1\": \"no\",\n    \"13-0\": \"Polish\",\n    \"13-1\": \"pl\",\n    \"14-0\": \"Portuguese\",\n    \"14-1\": \"pt-pt\",\n    \"16-0\": \"Russian\",\n    \"16-1\": \"ru\",\n    \"17-0\": \"Swedish\",\n    \"17-1\": \"sv\",\n    \"18-0\": \"Finnish\",\n    \"18-1\": \"fi\",\n    \"15-0\": \"Portuguese - Brazilian\",\n    \"15-1\": \"pt-br\",\n    \"19-0\": \"Turkish\",\n    \"19-1\": \"tr\"\n  },\n  \"cols\": 2,\n  \"rows\": 20\n}\n[/block]","excerpt":"This method allows you to send single voice message to one destination address.","slug":"single-voice-message","type":"endpoint","title":"Single voice message"}

postSingle voice message

This method allows you to send single voice message to one destination address.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

from:
string12345
Numeric sender ID length should be between 3 and 14 characters.
to:
required
string
Destination address must be written in the international format (Example: 41793026727).
text:
string
Message to be converted to speech and played to subscribers.
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 On success, response header HTTP status code will be `200 OK` and the message will be sent. If you try to send message without authorization, you will receive the `401 Unauthorized` error . ### VoiceResponse |Parameter|Type|Description| |-|-|-| |*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#section-status-object-example).| |*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.| # Languages List of supported languages: [block:parameters] { "data": { "h-0": "Language", "h-1": "Language shortcut", "0-0": "English", "0-1": "en", "1-0": "Spanish", "1-1": "es", "2-0": "Catalan", "2-1": "ca", "3-0": "Chinese-Simplified", "3-1": "zh-cn", "4-0": "Chinese-Traditional", "4-1": "zh-tw", "5-0": "Danish", "5-1": "da", "6-0": "Dutch", "6-1": "nl", "7-0": "French", "7-1": "fr", "8-0": "German", "8-1": "de", "9-0": "Italian", "9-1": "it", "10-0": "Japanese", "10-1": "ja", "11-0": "Korean", "11-1": "ko", "12-0": "Norwegian", "12-1": "no", "13-0": "Polish", "13-1": "pl", "14-0": "Portuguese", "14-1": "pt-pt", "16-0": "Russian", "16-1": "ru", "17-0": "Swedish", "17-1": "sv", "18-0": "Finnish", "18-1": "fi", "15-0": "Portuguese - Brazilian", "15-1": "pt-br", "19-0": "Turkish", "19-1": "tr" }, "cols": 2, "rows": 20 } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}