Specification of the Text to Voice object
The Text to Voice channel object goes into the channel object under the text2voice key - see Cascade. Instead of a written message, the recipient gets a phone call that reads the text aloud.
Text to Voice is a transactional-only channel. It is available in Advanced transactional, not in Advanced promotional - a request that puts text2voice into a promotional channel is rejected with Unexpected item 'text2voice'.
Text to Voice object
| PARAMETER NAME | VALUE | MANDATORY | DEFAULT VALUE |
|---|---|---|---|
| text | The text read aloud to the recipient. Overrides the top-level text, see Which text is used. SSML is supported, variables are not - see the notes below. |
No | null |
| sender | Sender (calling line) the recipient sees. Leave empty to use the default. | No | null |
| language | Language the text is spoken in. Uses an ISO code from Supported languages. If omitted, it is auto-detected from the recipient's country / phone number, falling back to English. | No | auto |
| prefer_gender | Preferred voice gender, male or female. If the language has only one voice, that voice is used regardless. |
No | male |
| speed | Speaking speed as a multiplier - 1.0 is normal, 1.5 is faster, 0.8 is slower. |
No | 1.0 |
| expiration | Time limit in seconds after which the next channel in the cascade is used. Values below 60 are ignored and replaced by the default. |
No | 180 |
Variables are not substituted in Text to Voice. The text is read exactly as sent, so a placeholder like <first_name> would be read out literally. Put the final wording directly into text (or into number[].text per recipient). To make a code or number easy to understand, write it out with spaces, e.g. 1 2 3 4.
SSML is supported for finer control over how the text is spoken (pauses, spelled-out characters, …). Use SSML tags directly - do not wrap the whole text in <speak>…</speak>, the voice engine adds that itself. A surrounding <speak> wrapper is stripped automatically; inner tags such as <say-as interpret-as="characters">AB</say-as> or <break time="300ms"/> are kept.
Which text is used
The spoken text is taken from the first non-empty place in this order:
| PRIORITY | PLACE | NOTE |
|---|---|---|
| 1 | channel.text2voice.text |
text for the Text to Voice channel |
| 2 | number[].text |
text of one specific recipient, see Value `number` |
| 3 | text |
top-level text of the request |
Supported languages
language must be one of these ISO codes. An unsupported value is rejected rather than silently replaced.
| CODE | LANGUAGE | CODE | LANGUAGE | CODE | LANGUAGE | CODE | LANGUAGE |
|---|---|---|---|---|---|---|---|
af |
Afrikaans | ca |
Catalan | el |
Greek | eu |
Basque |
ar |
Arabic | cs |
Czech | en |
English | fi |
Finnish |
bg |
Bulgarian | da |
Danish | es |
Spanish | fr |
French |
bn |
Bengali | de |
German | et |
Estonian | gl |
Galician |
gu |
Gujarati | id |
Indonesian | kn |
Kannada | ml |
Malayalam |
he |
Hebrew | is |
Icelandic | ko |
Korean | mr |
Marathi |
hi |
Hindi | it |
Italian | lt |
Lithuanian | ms |
Malay |
hu |
Hungarian | ja |
Japanese | lv |
Latvian | nl |
Dutch |
no |
Norwegian | pt |
Portuguese | sk |
Slovak | ta |
Tamil |
pa |
Punjabi | ro |
Romanian | sr |
Serbian | te |
Telugu |
pl |
Polish | ru |
Russian | sv |
Swedish | tr |
Turkish |
uk |
Ukrainian | vi |
Vietnamese | zh |
Chinese |
Example of full request
A verification call to two numbers. The code is spelled out with spaces so it is read digit by digit, the voice is female and speaks a little slower than normal. country lets the language be auto-detected when language is omitted.
Text to Voice as the last fallback in a cascade - Viber is tried first, then SMS, and if neither is delivered the recipient is called. Each channel keeps its own expiration.
In the second example text2voice has no text of its own, so it reads the top-level text - see Which text is used.
The response is the same for every channel - see Advanced transactional.
Thank you for your feedback.