Dynamic Variables are not working
# support
g
Hey all, this is how my request looks like: { "assistantId": "43a7f214-9351-4a17-a0cf-15d47ae48323", "phoneNumberId": "735ca5d5-773-46ab-b823-fb342a2895fc", "customer": { "number": "+1234567890", "assistantOverrides": { "variableValues": { "name": "John", "appointmentTime": "3 PM", "timezone": "PST" }, "metadata": { "name": "John", "appointmentTime": "3 PM", "timezone": "PST" } } } } And this is how part of my prompt looks like: 2. After they respond, say "Thank you {{name}}. Mr. Doe asked me to personally give you a call regarding your application. I see you booked a call for {{appointmentTime}} {{timezone}}. Can you confirm that that time works for you?" However, in the call it doesn't have access to any of the dynamic variable values. I've looked at the documentation, and it seems like everything is properly configured. Could anyone from the @User kindly check that this isn't a mistake on my side? Thank you!
v
Your
assistantOverrides
is incorrectly nested inside the
customer
object. It should be at the top level of your request. Here's the correct structure:
Copy code
json
{
    "assistantId": "43a7f214-9351-4a17-a0cf-15d47ae48323",
    "phoneNumberId": "735ca5d5-773-46ab-b823-fb342a2895fc",
    "assistantOverrides": {
        "variableValues": {
            "name": "John",
            "appointmentTime": "3 PM",
            "timezone": "PST"
        }
    },
    "customer": {
        "number": "+1234567890"
    }
}
According to [Vapi's documentation](https://docs.vapi.ai/assistants/dynamic-variables), dynamic variables must be passed in the
assistantOverrides
object at the top level. Source: - [Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables)
c
Hey! To help track down this issue, could you share: - The call ID - When exactly this happened (the timestamp) - What response you expected to get - What response you actually got instead This would really help us figure out what went wrong!
g
@Vapi Support Bot I tried that and got the error {"message":["assistantOverrides.property customer should not exist"],"error":"Bad Request","statusCode":400}
v
The error suggests you still have a
customer
property inside your
assistantOverrides
object. Make sure your request looks exactly like this:
Copy code
json
{
    "assistantId": "43a7f214-9351-4a17-a0cf-15d47ae48323",
    "phoneNumberId": "735ca5d5-773-46ab-b823-fb342a2895fc",
    "assistantOverrides": {
        "variableValues": {
            "name": "John",
            "appointmentTime": "3 PM",
            "timezone": "PST"
        }
    },
    "customer": {
        "number": "+1234567890"
    }
}
Double-check that you've removed any
metadata
or other properties containing
customer
from within
assistantOverrides
. Source: - [Discord conversation about assistantOverrides structure](https://discord.com/channels/1211482211119796234/1344652901791961211)
g
@Vapi Support Bot I got {"message":["customer.property metadata should not exist"],"error":"Bad Request","statusCode":400}
v
Remove the
metadata
property from your
customer
object. The correct structure should be:
Copy code
json
{
    "assistantId": "43a7f214-9351-4a17-a0cf-15d47ae48323",
    "phoneNumberId": "735ca5d5-773-46ab-b823-fb342a2895fc",
    "assistantOverrides": {
        "variableValues": {
            "name": "John",
            "appointmentTime": "3 PM",
            "timezone": "PST"
        }
    },
    "customer": {
        "number": "+1234567890"
    }
}
The
customer
object should only contain the
number
property in this case. Source: - [Discord conversation about assistantOverrides structure](https://discord.com/channels/1211482211119796234/1344652901791961211)
v
Message marked as helpful by @Gabriel C! 🎉
k
checking if this is resolved/solved for you?