Tokens are placeholders written as {{name}} that IVR Studio fills in during a call: the caller's number, the key just pressed, the menu option chosen, a spoken answer, or a variable you passed when starting the call. Prompts accept {{var.*}} tokens; HTTP Request and Email nodes accept every token. Variables come from the outbound API or a test call.
All tokens#
| Token | Value |
|---|---|
{{caller}} |
The caller's number (on an outbound call, the number dialled) |
{{did}} |
The other number on the call (your IVR number on an inbound call) |
{{digits}} |
The key just pressed in a Menu, e.g. 2 |
{{menu_choice}} |
The label of that menu option, e.g. Support |
{{answer.<question key>}} |
A spoken answer captured by an Ask node, e.g. {{answer.city}} |
{{var.<name>}} |
A per-call variable, e.g. {{var.order_id}} |
{{voicemail_url}} |
Link to the voicemail recorded on this call |
{{reference_id}} |
Your reference_id from the outbound API |
{{call_sid}} |
The call's ID |
{{flow_id}} |
The flow's ID |
{{time}} |
Now, in IST, readable |
{{time_iso}} |
Now, in UTC, RFC 3339 |
Where tokens work#
| Place | Tokens allowed |
|---|---|
| Say text, Menu prompt, Ask question | {{var.<name>}} only |
| HTTP Request URL (path and query), header values, body | All tokens |
| Email subject and message | All tokens |
| Order Action tag and note | Tokens allowed |
A {{var.*}} the call doesn't have is spoken as nothing. In an HTTP request or email, an unknown token is sent unchanged, so typos are easy to spot.
Passing variables#
Variables come from:
- the
variablesobject of POST/v1/ivr/calls; - the Variables (JSON, optional) box of a test call;
- an order automation, which fills order variables such as
customer_nameandcod_amount.
{ "variables": { "order_id": "A123", "name": "Ravi", "amount": 499 } }
Variable limits#
| Limit | Value |
|---|---|
| Variables per call | 20 |
| Name | Letters, digits and _, starting with a letter or _, up to 64 characters ([a-zA-Z_][a-zA-Z0-9_]{0,63}) |
| Value | String, number or boolean (stored as a string), up to 512 characters. Objects and arrays are rejected |
| Total size | 4 KB |
Safe substitution#
In HTTP requests, token values are escaped for where they land. A value can't break out of a JSON string, add a query parameter, add a header line or change the host. For JSON bodies, put tokens inside string values: {"order_id": "{{var.order_id}}"}.
Variables in logs#
Each call's variables are shown in Call Logs and returned by GET/v1/ivr/calls/{call_sid} and the status callback.