Variables not passing to url when testing and in l...
# support
r
When trying to pass a variable in a URL, it just comes up blank or with the actual variable name. eg {{name}} instead of the actual variable. Can you please fix?
v
To ensure your variable (e.g.,
{{name}}
) is replaced in the URL, pass it in your API request using
assistantOverrides.variableValues
like this:
Copy code
json
{
  "assistantId": "your-assistant-id",
  "assistantOverrides": {
    "variableValues": {
      "name": "John"
    }
  }
}
Make sure the variable name in your URL matches exactly (e.g.,
https://api.yourcompany.com/orders/{{name}}
). This should resolve the issue of variables not being replaced in your URLs when testing or live. See the [Vapi documentation for dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables#prepare-your-request) for more details. Source: - [Vapi documentation for dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables#prepare-your-request)
c
Hi roadrunna, To use dynamic variables in our API, you need to define them using double curly braces (e.g.,
{{variableName}}
) in your messages or prompts. Ensure you provide their values during a phone call via the
assistantOverrides
with
variableValues
. Here's a JSON example of how you can set this up for a phone call:
Copy code
json
{
  "assistantId": "your-assistant-id",
  "assistantOverrides": {
    "variableValues": {
      "name": "John"
    }
  },
  "customer": {
    "number": "+1xxxxxxxxxx"
  },
  "phoneNumberId": "your-phone-id"
}
Dynamic variables are not directly settable within the dashboard. If you're using the LiquidJS library for formatting the date or time, here's an example of how you could use it:
Copy code
liquid
{{"now" | date: "%A, %B %d, %Y, %I:%M %p", "America/Los_Angeles"}}
For more details, you can refer to the [document on dynamic variables](https://docs.vapi.ai/assistants/dynamic-variables).
2 Views