deep-jade
deep-jade5mo ago

Setup dynamic variables as soon as inbound call comes in

Hi I want to link this assistant to multiple phone numbers and based on phone number, I want this agent to greet differently. But the issue is I am unable to setup dynamic variables using the call update api. Call id is 2dadfca8-3395-41f1-935d-3a1e1dbd9d9d
No description
12 Replies
Vapi Support Bot
The error occurs because you're trying to add properties that aren't defined in your assistant's configuration. Based on the error message, your assistant doesn't have restaurantName and restaurantPhone variables defined. First, define these variables in your assistant configuration. Then use the call update API correctly:
// PATCH /call/{callId}
{
"name": "Optional call name",
"assistantOverrides": {
"variableValues": {
"restaurantName": "DF restaurant",
"restaurantPhone": "03 5678 8907"
}
}
}
// PATCH /call/{callId}
{
"name": "Optional call name",
"assistantOverrides": {
"variableValues": {
"restaurantName": "DF restaurant",
"restaurantPhone": "03 5678 8907"
}
}
}
Make sure these variable names match exactly what's defined in your assistant's prompts (using {{variableName}} format). Sources: - Dynamic Variables - Call Update API
⤵️ Mention @Vapi Support Bot for follow-ups 🐥
deep-jade
deep-jadeOP5mo ago
How do I define these values in assistant’s configuration?
conscious-sapphire
conscious-sapphire5mo ago
Like we said, kindly just inbox me. I'll get this done for you
deep-jade
deep-jadeOP5mo ago
I tried but can’t send you message It’s blocking
conscious-sapphire
conscious-sapphire5mo ago
Send me a friend request
Sahil
Sahil5mo ago
checking if this is resolved/solved for you?
deep-jade
deep-jadeOP5mo ago
Not yet Still experiencing the same issue Hi any help with this?
Sahil
Sahil5mo ago
To customize your assistant's greeting based on the incoming phone number, make sure you're using the correct JSON payload format when making the call via the API. Include the "variableValues" in the "assistantOverrides" section to set dynamic variables for your assistant. Here's a quick example to guide you:
{
"assistantId": "your-assistant-id",
"assistantOverrides": {
"variableValues": {
"greeting": "Hi, welcome to our service!",
"number": "+1234567890"
}
},
"customer": {
"number": "+1234567890"
},
"phoneNumberId": "your-phone-id"
}
{
"assistantId": "your-assistant-id",
"assistantOverrides": {
"variableValues": {
"greeting": "Hi, welcome to our service!",
"number": "+1234567890"
}
},
"customer": {
"number": "+1234567890"
},
"phoneNumberId": "your-phone-id"
}
Ensure your assistant's prompts include placeholders like {{greeting}} to apply these dynamic variables. If the variables are not setting correctly, double-check the format and ensure they're correctly implemented in your assistant's messages. If you need further assistance, feel free to reach out.
deep-jade
deep-jadeOP5mo ago
Thanks my calls are coming in by directly calling the phone number. I am not creating a call via api.
Sahil
Sahil5mo ago
Hey @anshu, by today I'll publish a documentation on how to customize the calls for your users, or allow me some time.
deep-jade
deep-jadeOP5mo ago
Thanks @Shubham Bajaj Are you able to share the link of document here as well. Thanks

Did you find this page helpful?