Vansh Soni
04/05/2025, 8:11 AMVapi Support Bot
04/05/2025, 8:13 AMjson
"assistantOverrides": {
"variableValues": {
"name": "",
"email": ""
}
}
The agent is asking for an email because you're explicitly setting email
to an empty string (""
). When your prompt checks for {{email}}
, it finds an empty value, which is why it's always going to the "If {{email}} is not found" branch of your logic.
To fix this, you need to pass an actual email address in the variable. For example:
json
"assistantOverrides": {
"variableValues": {
"name": "User Name",
"email": "user@example.com"
}
}
According to the [Vapi documentation on dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables), dynamic variables are used to personalize assistant messages and prompts by setting values to templates defined using double curly braces. When you set email
to an empty string, the system correctly replaces {{email}}
with that empty string, which then fails your condition check.
If you want to conditionally include the email variable only when you have it, you might need to modify your approach. One option is to not include the email key at all in variableValues when you don't have an email to provide.
Is there anything else you'd like to know about handling dynamic variables in Vapi?
Source:
- [Vapi documentation on dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables)Vansh Soni
04/05/2025, 8:30 AMSven
04/05/2025, 11:11 AMKyle Brunker
04/06/2025, 8:51 AM