Using Variables
Sync
Currently, the sync API only supports single value variable substitution.
{
"data": {
"title": "Sync API Vars Test",
"body": "<speak><p>{{n}} divided by {{d}} equals {{result}}</p></speak>",
"voice": "375ef3a1",
"variables": { "n": 1, "d": 2, "result": 0.5 }
}
}
Async
The async API allows substituting multiple variables with multiple values. The callback URI receives a message for each variable combination as they are synthesized, one at a time.
{
"data": {
"title": "Sync API Vars Test",
"body": "<speak><p>The {{animal}} is very {{adjective}}.</p></speak>",
"voice": "375ef3a1",
"variables": { "animal": ["giraffe", "zebra"], "adjective": ["colourful", "beautiful"] }
},
"callback_uri": "..."
}