how to pass custom variables when I call workflow
# support
x
Hi all, how can I pass custom variables to workflow through HTTP request? I've tried different approaches This approach is not accepted when I call workflow "assistantOverrides": { "variableValues": { "name": "John" } This doesn't throw an error but the assistant doesn't get the variables in metadata and they just read the variables name. { "type": "outboundPhoneCall", "workflowId": "asdfdsafd", "phoneNumberId": "fdsafdsafdsa", "customer": { "number": "{{ $node['Recruiter with Phone Number?'].json.message.content.phoneNumber }}" }, "metadata": { "messageID": "{{ $node['Get a message'].json.id }}", "recruiterName": "{{ $node['Recruiter with Phone Number?'].json.message.content.recruiterName }}", "emailSummary": "{{ $node['Recruiter with Phone Number?'].json.message.content.Summary }}" } } I made sure that the variable names are identical. Any idea how to approach it? #1211483291191083018 #1228667357849849856 #1211484481848873020
k
Pass custom variables via assistantOverrides.variableValues in your HTTP request, not metadata, then use {{variableName}} in your workflow prompts..
x
I've tried that, the problem is that I don't call assisstant but the workflow, That message with assistantOverrides.variableValues errors out
k
You can’t pass custom variables to a workflow directly only assistant calls support assistantOverrides.variableValues, so use an assistant to inject variables before routing to the workflow..
c
i'm having the same issue, i can pass things like customer.name works fine but any variables passed in the assistantOverrides and variableValues aren't being picked up in the workflow, the agent is just reading the variable names
Im posting to api.vapi.ai/campaign with a body of{ "name": "Q2 Sales Campaign", "phoneNumberId": "0592481e-5f55-4307-8422-redacted", "workflowId":"e6b05790-8be4-4b77-8e4b-redacted", "customers": [ { "name":"Johnson the Fourth", "number":"+redacted", "assistantOverrides":{ "variableValues":{ "id2":"Wooly", "specific.product":"Beef Burgers", "id22":"Big Jumpers" } } } ] } and the worflow in the introduction node first message i have "Hello, this is Morgan from GrowthPartners. Do you have a few minutes to chat about how we might be able to help your business? Am i right in saying your name is {{customer.name}}? We do {{specific.product}} and {{id22}}." trying to test it extracting these variables. It Uses customer.name perfectly everytime.
c
Variables only work if passed via
workflowOverrides.variableValues
in a webhook response or
assistantOverrides.variableValues
when starting from an assistant, direct workflow calls can't use dynamic variables yet..
c
I see, thank you. So what is the point in workflowOverrides.variableValues then if you can't use dynamic variables? And what's the workaround for this? i know you used to be able to make assistants that use workflows but i can't understand how to do this since recent updates. thanks again!
k
workflowOverrides.variableValues
only works when routing from an assistant via webhook; to use dynamic variables, start with an assistant using
assistantOverrides
, then redirect to a workflow..
c
Hi to anyone here, i fixed this issue just by having an API tool make a call home to retrieve the information and submitting the externalId variable to declare the ID for this call for when the tool calls home for all the variables it needs.
k
Glad it fixed
4 Views