Can't add variable to workflows or assistants
# support
a
Hi y'all, I tried creating a call with the following request const response = await fetch('https://api.vapi.ai/call', { method: 'POST', headers: { Authorization:
Bearer ${process.env.VAPI_API_KEY}
, 'Content-Type': 'application/json', }, body: JSON.stringify({ workflowId: '82e77365-c659-4c39-9d91-9f87f26ca433', phoneNumberId: 'c0875f04-3617-40b9-9d11-558980699222', customer: { number: from }, workflowOverrides: { variableValues: { clinicName, }, }, }), }); But it doesn't seem to pass the variable clinicName to the workflow, even though I tag it as {{clinicName}} in the workflow. Not sure why this is happening, given I already did exactly what the documentation at https://docs.vapi.ai/api-reference/calls/create is instructing. I can, however, manually input the variable on the website before the call. But that's just a one off and not dynamic. The same problem goes for assistantId and assistantOverrides when I try to use an assistant. Could any be so kind as to help me out with this : ) Thanks, Andy
v
Try this JSON payload to pass the
clinicName
variable to your workflow:
Copy code
json
{
  "workflowId": "82e77365-c659-4c39-9d91-9f87f26ca433",
  "phoneNumberId": "c0875f04-3617-40b9-9d11-558980699222",
  "customer": { "number": "+1xxxxxxxxxx" },
  "workflowOverrides": {
    "variableValues": {
      "clinicName": "My Clinic"
    }
  }
}
Make sure
{{clinicName}}
is referenced exactly (case-sensitive) in your workflow prompts. If this still doesn't work, double-check that the variable is used in a node and matches the payload key
([docs reference](https://docs.vapi.ai/assistants/dynamic-variables#using-dynamic-variables-in-a-phone-call)). Source: - [Using dynamic variables in a phone call](https://docs.vapi.ai/assistants/dynamic-variables#using-dynamic-variables-in-a-phone-call)
a
Hey this is the updated request const response = await fetch('https://api.vapi.ai/call', { method: 'POST', headers: { Authorization:
Bearer ${process.env.VAPI_API_KEY}
, 'Content-Type': 'application/json', }, body: JSON.stringify({ workflowId: '82e77365-c659-4c39-9d91-9f87f26ca433', phoneNumberId: 'c0875f04-3617-40b9-9d11-558980699222', customer: { number: '+61256618209' }, workflowOverrides: { variableValues: { clinicName: 'Victoria Family Clinic', }, }, }), }); Though it's not exactly any different since they're just variables And, expectedly, I still get the same error
Any luck guys doesn't look like any support is getting put forward?
c
Passing clinicName via workflowOverrides.variableValues doesn’t work in Vapi; instead, use assistantOverrides.variableValues with a linked assistant, as workflow variables can’t be dynamically injected through the API..
4 Views