Setup dynamic variables as soon as inbound call co...
# support
a
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 https://cdn.discordapp.com/attachments/1367103583845224568/1367103584415514795/IMG_1035.jpg?ex=68135dee&is=68120c6e&hm=a2b9b0010a31b77620a28034eff19ca096afe2e36d5636be925b235dc11e78d3&
v
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:
Copy code
json
// 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](https://docs.vapi.ai/assistants/dynamic-variables) - [Call Update API](https://docs.vapi.ai/api-reference/calls/update)
a
How do I define these values in assistant’s configuration?
e
Like we said, kindly just inbox me. I'll get this done for you
a
I tried but can’t send you message
It’s blocking
e
Send me a friend request
v
checking if this is resolved/solved for you?
a
Not yet
Still experiencing the same issue
Hi any help with this?
v
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:
Copy code
json
{
  "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.
a
Thanks my calls are coming in by directly calling the phone number. I am not creating a call via api.
v
Hey @anshu, by today I'll publish a documentation on how to customize the calls for your users, or allow me some time.
a
Thanks @Shubham Bajaj
Are you able to share the link of document here as well. Thanks
v
4 Views