Inbound dynamic variables
# support
a
I am working on an inbound agent, that needs dynamic variables. Found this support thread. However, it seems we can only update a calls name with the API. https://docs.vapi.ai/api-reference/calls/update/~explorer How can I set the variables then ?
v
Hi there! I can help you with setting dynamic variables for your inbound agent 👋 Looking at the endpoint you shared, you're right that the
/calls/update
endpoint only allows updating limited call properties like name. However, for setting dynamic variables in an inbound agent, you'll need to use a different approach. According to the documentation, you should use the
assistantOverrides
configuration with
variableValues
when initiating a call. Here's how you can do it: 1. Structure your API request with a JSON payload like this:
Copy code
json
{
  "assistantId": "your-assistant-id",
  "assistantOverrides": {
    "variableValues": {
      "name": "John",
      "otherVariable": "value"
    }
  },
  "customer": {
    "number": "+1xxxxxxxxxx"
  },
  "phoneNumberId": "your-phone-id"
}
2. Send this payload to the
/call/phone
endpoint using a POST request. This will replace any occurrences of
{{name}}
or
{{otherVariable}}
in your assistant script with the values you've provided. For inbound agents specifically, you'll need to ensure these variables are configured when the call is being handled. The variables you set will be used to customize the conversation based on the placeholders in your assistant's script. If you're having trouble with the implementation, make sure that: - The variable names in your
variableValues
match exactly with the placeholders in your script - Your assistant is configured to accept these variables - The API request is correctly formatted Does this help with what you're trying to accomplish? Sources: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables) - [Discord Discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335054553250533439)
a
That response only covers when I am initating the call. This is for inbound calls.
v
Hello Amanski, What you're intending to do can be done through live call control. Here is the documentation: You can inject whatever context or information you would like programatically.