const response = vapi.start(assistantId, assistant...
# support
d
Hi, I am trying to use the assistantOverrides but it appears that the overrides are cached as they do not updates on subsequent requests. Specifically I am having issues with variableValues and metadata not updating:: variableValues: { name: "Michael" }, metadata: { userId: userId, organization: "CogniTrainer", test: "1234" } please advise
v
@deathless Hello! It sounds like you're experiencing issues with the
assistantOverrides
not updating as expected. This could be due to caching or state management within the VAPI system. To address this, please ensure that each request you send is unique and not a repeat of a previous one. You can do this by modifying the
metadata
or
variableValues
with a unique identifier for each request, such as a timestamp or a request ID. Here's an example of how you might modify your JSON payload to include a unique identifier:
Copy code
json
{
  "assistantId": "your-assistant-id",
  "assistantOverride": {
    "variableValues": {
      "name": "Michael"
    },
    "metadata": {
      "userId": "userId",
      "organization": "CogniTrainer",
      "test": "1234",
      "requestId": "unique-request-id" // Add a unique request ID here
    }
  }
}
Make sure to replace
"unique-request-id"
with an actual unique value for each request. If you continue to face issues, it may be necessary to clear any caches or sessions on the server side, or to consult the documentation for any additional steps required to refresh the overrides. If you need further assistance with this issue, please let me know, and I'll be happy to help!
You can continue this conversation by mentioning me in the message.
s
share the call id. also metadata property is not part of variableValues.
d
c621cbea-9933-41dc-948c-b679639ab13f
I'm not putting metadata in the variableValues
i tried using a unique requestID like above, and it did clear the cache, but when i tried it again, with new unique requestIds, it is still caching
{ serverUrl: SERVER_URL, recordingEnabled: true, variableValues: { requestId: uuidv4(), name: "Michael" }, metadata: { requestId: uuidv4(), userId: userId, organization: "OSU", test: "1234" }
thanks for your help!
I don't understand what's going on here. It does NOT cache either requestId, but caches everything else
here is another one: 34cd31c1-d42c-47f5-a3cf-55641d6f4757
s
hey your not using assistant overrides correctly your supposed to name them in camelCase and use them with following syntax to be replace {{name}}
d
I am using camel case, am I not? I used the example that your docs gave and it is not working. the only reason I need these variables is to grab them when you guys do the callback. I get the call id and then do a GET to retrieve the call and then log the call into my system. I need to insert a userId when I make the call.
Hi, can you please help me?
s
hey @deathless how your planning to use assistant overrides for metadata, i am sure there is misunderstanding. If you can share how your planning to use it then i can help better.
d
I need to keep track of my user for billing purposes, so I need to put the userId into the call so when i retrieve the call info when it is finished, i can get the costs and userId for the call and log that in my database
Thanks
@Shubham Bajaj
s
you have to make GET /call/:id because end of call report doesn't returns the assistant overrides unless you use it in your system prompt
d
@Shubham Bajaj I understand that. What I am trying to do is to get that userId into the metadata or variableValues of the call without having them cache. That is the issue
s
"assistantOverrides": { "metadata": { "test": "1234", "userId": "3", "requestId": "1906e8c1-1bd8-479c-b06f-daff9e31b6ee", "organization": "CogniTrainer" }, "variableValues": { "name": "Michael", "requestId": "dee31c4e-3403-4809-8133-b9c5ad9d2643" }, "assistantOverrides": { "metadata": { "test": "1234", "userId": "3", "requestId": "81519306-4ad0-42d4-ab26-135ec9e8102c", "organization": "CogniTrainer" }, "variableValues": { "name": "Michael", "requestId": "d935a5bb-755d-4f7d-a49b-56e382fa5724" }, "recordingEnabled": true },
@deathless this is two of your call id overrides, please check in your logs.
3 Views