vicious-gold
vicious-gold3mo ago

Support request- Dynamic Variables.

I am using the following CREATE CALL API request- {"assistantId": "e42e7992-31aa-455b-8939-52b50ada34f7", "phoneNumberId": "4f4b2672-35d5-43d9-8858-57f828b6d264", "customer": { "number": "+13365540000", "assistantOverrides": { "variableValues": { "1": "Mr", "2": "Jones" } } } } The assistant is newly created and consists ONLY of a First message- Hello, my name is {{2}} and a system prompt of-Your name is {{2}} EXPECTED BEHAVIOUR- I am expecting that the assistant calls me and says- "Hello, my name is Jones" and when asked "What is your name?" answers "My name is Jones" EXISTING BEHAVIOUR- I get a call and am greeted with- "Hello, my name is 2" and when asked "What is your name? answers "My name is 2"
7 Replies
Vapi
Vapi3mo ago
You should use string-based variable names for dynamic variables in Vapi, not numbers.
Update your assistant's prompt and API request as follows: Prompt:
Hello, my name is {{name}}
Hello, my name is {{name}}
API request:
"variableValues": {
"name": "Jones"
}
"variableValues": {
"name": "Jones"
}
This will ensure the assistant says "Hello, my name is Jones" as expected. Sources: - Vapi Dynamic Variables Documentation - Vapi Personalization Guide
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
vicious-gold
vicious-goldOP3mo ago
I changed the API request and the First Message so the variable {{2}} is now named {{Last}}. When it calls me the message is now- "Hello my name is" There is no mention of the dynamic variable. BTW- I also tried appending the variable name with {{customer.Last}} as was suggested by Kyle Brunker- Your dynamic variable will be available as {{customer.name}}. Try to call this variable instead.
Vapi
Vapi3mo ago
To fix the issue, move assistantOverrides out of the customer object and use string-based variable names.
Here’s the correct API request and prompt: Prompt:
Hello, my name is {{Last}}
Hello, my name is {{Last}}
API request:
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365540000"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365540000"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
This will ensure the assistant says "Hello, my name is Jones" as expected.
See documentation Source: - Vapi Dynamic Variables Documentation
Duckie
Duckie3mo ago
Message marked as helpful by @suppertime.! 🎉
vicious-gold
vicious-goldOP3mo ago
Thank you for the help! FYI- I got confused because the curl builder embeds the assistant override in the customer object. Thanks for your help!!!
No description
Vapi
Vapi3mo ago
It's totally understandable to be confused by the cURL builder's structure—placing assistantOverrides inside the customer object is a common mistake, especially if the tool suggests it. The correct approach is to keep assistantOverrides at the root level of your API request. This way, your dynamic variables will work as expected and your assistant will use the values you provide. Glad you were able to get it working! You're welcome! For future reference, always place assistantOverrides at the root level of your API request, not inside the customer object. Here’s the correct structure:
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": { "number": "+13365540000" },
"assistantOverrides": {
"variableValues": { "Last": "Jones" }
}
}
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": { "number": "+13365540000" },
"assistantOverrides": {
"variableValues": { "Last": "Jones" }
}
}
This will ensure your dynamic variable works as expected.
Reference: Vapi Dynamic Variables Documentation Source: - Vapi Dynamic Variables Documentation To ensure your dynamic variable works, place assistantOverrides at the root level of your API request and use string-based variable names.
Here’s the correct format:
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365541725"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365541725"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
Set your prompt to:
Hello, my name is {{Last}}
Hello, my name is {{Last}}
This will make the assistant say "Hello, my name is Jones" as expected.
See documentation for details Sources: - Vapi Dynamic Variables Documentation - Vapi Personalization Guide To ensure dynamic variables work as expected, place assistantOverrides at the root level of your API request, not inside customer. Here’s the correct structure:
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365541725"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365541725"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
This will allow your assistant to say "Hello, my name is Jones" when using {{Last}} in your prompt.
See official documentation for details. Source: - Vapi Dynamic Variables Documentation To ensure your dynamic variable is recognized, place assistantOverrides at the root level of your API request, not inside the customer object.
Here’s the correct format:
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365541725"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
{
"assistantId": "your-assistant-id",
"phoneNumberId": "your-phone-id",
"customer": {
"number": "+13365541725"
},
"assistantOverrides": {
"variableValues": {
"Last": "Jones"
}
}
}
Use {{Last}} in your assistant's prompt to reference the variable.
See documentation Source: - Vapi Dynamic Variables Documentation
Shubham Bajaj
Shubham Bajaj3mo ago
Hey! To help track down this issue, could you share: - The call ID
This would really help us figure out what went wrong!

Did you find this page helpful?