Overview
Use dynamic variables in the system prompt or any message in the dashboard with curly braces (e.g.,{name}).
To set values, make a phone call request through the API and set assistantOverrides. You cannot set variable values directly in the dashboard.
For example, set the assistant’s first message to “Hello, {name}!” and assign name to Akash by passing assistantOverrides with variableValues:
Using dynamic variables in a phone call
1
Prepare Your Request
Create a JSON payload with these key-value pairs:
assistantId: Replace"your-assistant-id"with your assistant’s actual ID.assistantOverride: Customize your assistant’s behavior.variableValues: Include dynamic variables in the format{ "variableName": "variableValue" }. Example:{ "name": "John" }.
customer: Represent the call recipient.number: Replace"+1xxxxxxxxxx"with the recipient’s phone number (E.164 format).
phoneNumberId: Replace"your-phone-id"with your registered phone number’s ID. Find it on the Phone number page.
2
Send the Request
Send the JSON payload to the
/call/phone endpoint using your preferred method (e.g., HTTP POST request).Ensure
{variableName} is included in all prompts where needed.Default Variables
These variables are automatically filled based on the current (UTC) time, so you don’t need to set them manually invariableValues:
Advanced date and time usage
You can use advanced date and time formatting in any prompt or message that supports dynamic variables in the dashboard or API. We use LiquidJS for formatting - see their docs for details. Format a date or time using the LiquidJSdate filter:
Monday, January 01, 2024, 03:45 PM
Examples:
- 24-hour time:
→
17:30 - Day of week:
→
Tuesday - With customer number:
Using dynamic variables in the dashboard
To use dynamic variables in the dashboard, include them in your prompts or messages using curly braces. For example:name) in the call configuration or via the API/SDK.
Always use curly braces (
{variableName}) to reference dynamic variables in your prompts and messages.