Support request- Dynamic Variables.
# support
s
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"
v
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:
Copy code
Hello, my name is {{name}}
API request:
Copy code
json
"variableValues": {
  "name": "Jones"
}
This will ensure the assistant says "Hello, my name is Jones" as expected. Sources: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables) - [Vapi Personalization Guide](https://docs.vapi.ai/assistants/personalization)
s
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.
v
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:
Copy code
Hello, my name is {{Last}}
API request:
Copy code
json
{
  "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](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
v
Message marked as helpful by @suppertime.! 🎉
s
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!!! https://cdn.discordapp.com/attachments/1377694800337309866/1377701527623569529/image.png?ex=6839ec08&is=68389a88&hm=68b6d79550352578875f58cea9ff1bf433533bbecc9a8f6cb98717f2bae99d99&
v
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:
Copy code
json
{
  "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](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
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:
Copy code
json
{
  "assistantId": "your-assistant-id",
  "phoneNumberId": "your-phone-id",
  "customer": {
    "number": "+13365541725"
  },
  "assistantOverrides": {
    "variableValues": {
      "Last": "Jones"
    }
  }
}
Set your prompt to:
Copy code
Hello, my name is {{Last}}
This will make the assistant say "Hello, my name is Jones" as expected. [See documentation for details](https://docs.vapi.ai/assistants/dynamic-variables) Sources: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables) - [Vapi Personalization Guide](https://docs.vapi.ai/assistants/personalization)
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:
Copy code
json
{
  "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.](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
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:
Copy code
json
{
  "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](https://docs.vapi.ai/assistants/dynamic-variables) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
c
Hey! To help track down this issue, could you share: - The call ID This would really help us figure out what went wrong!
4 Views