rival-black•2w ago
inconsistent dynamic variable use in first message
I’m experiencing an issue with dynamic variables when my agent first starts speaking at the beginning of a phone call. When the call connects, the agent sometimes says the variable name itself (e.g., {{agent_name}}) instead of the actual substituted value.
This only happens in the first message and is inconsistent — sometimes it works correctly, sometimes it doesn’t.
As a workaround, I tried splitting the greeting:
First message: “Hello”
Prompt: “My name is {{agent_name}}, how can I help you?”
This fixes the substitution issue but introduces a new inconsistency: sometimes the agent just says “Hello” and waits for a response, other times it continues with the full greeting in one go.
Questions:
Is this a known issue?
Is there a way to guarantee the dynamic variable is always substituted before the first message is spoken?
Will Vapi continue to use the current “first message” structure? I feel the performance here is worse compared to Retell.ai, where the node has a “AI speaks first” option.
Would it be possible to add a “skip user response” option? Sometimes even with an empty edge, the agent still doesn’t continue the conversation automatically.
Thanks in advance for your help,
5 Replies
To help ensure dynamic variables are substituted in the first message, make sure you pass the variable values using
assistantOverrides.variableValues
when starting the call. For example:
Use the {{agent_name}}
syntax in your prompt, and this value will be injected at runtime. This approach is recommended for consistent variable substitution in Vapi calls (docs).
Source:
- Variables Vapi Documentation⤵️ Mention @Vapi Support Bot for follow-ups 🐥
rival-blackOP•2w ago
i am working in a workflow not an assistant
Hi Swek,
Send them in workflowOverrides.variableValues within the same /call/phone POST request that starts the call, matching variable names exactly in your prompt..
rival-blackOP•2w ago
it's for an incoming call.
tried workflowOverrides.variableValues before but didn't work.
Issue could have been because of a race condition that the dynamic variable, pulled from an api request, wasn't saved before the welcome node triggering.
Added an edge requiring a value for the dynamic variable. will check and comeback if it works/fails
We will be on standby to hear about the results of your test for dynamic variables. For future reference, please note that empty node edges will create unexpected behavior since that is one of the main points for the system to make a decision on how to proceed.