foreign-sapphire
foreign-sapphire8mo ago

what's the server message format for passing back variableValues in the POST request?

The API playground doesn't let me add in variableValues afaik so just want to make sure I'm capturing them correctly. Would think it is: message.variableValues.[variable_name], but that doesn't seem to work
8 Replies
Vapi
Vapi8mo ago
@Sahil It seems like you're trying to access variable values within the API playground. The correct way to access variable values would typically depend on the specific API's documentation and the structure of the data it provides. If you're working with a JSON message, you might access a variable using a path similar to message.variableValues.variable_name without the square brackets. However, if message.variableValues.[variable_name] is not working as expected, it's possible that the syntax might be incorrect or the API playground you're using may have specific rules for accessing variables. Could you please provide more details or clarify the context in which you're trying to capture these variable values? If you're referring to a specific part of the VAPI documentation or a feature within the API playground, that information would be helpful in assisting you further. If this is a feature that should be available but isn't working as expected, it might be best to reach out to the support team for the API playground you're using. You can continue this conversation by mentioning me in the message.
foreign-sapphire
foreign-sapphireOP8mo ago
message.variableValues.variable_name is not working. I'm just trying to pass in a variableValue titled email and then retrieve that same variableValue in the post request does it need to be messages.assistantOverrides.variableValues.variable_name?
optimistic-gold
optimistic-gold8mo ago
Vapi on Notion
Setting Up Dynamic Variables for Your Vapi Calls: A Quick Guide | N...
First, we need to point your phone number to your server:
optimistic-gold
optimistic-gold8mo ago
Do let me know if you require further help.
foreign-sapphire
foreign-sapphireOP8mo ago
it's not working - this is the error I keep getting from my webhook function: Webhook error: TypeError: Cannot read properties of undefined (reading 'variableValues') at Server.<anonymous> (file:///Users/sahilbhaiwala/xpert-connect-platform/supabase/functions/vapi-webhook/index.ts:29:50) at eventLoopTick (ext:core/01_core.js:168:7) at async #respond (https://deno.land/std@0.200.0/http/server.ts:222:18) my use case here is I want to pass in a customer's email address as a variableValue and then make sure I can tie the POST request I get back from Vapi to the appropriate customer via their email so I can update their database entry @Shubham Bajaj if you're available for a quick 2 min chat that'd be amazing pls let me konw this is blocking me quite a bit
optimistic-gold
optimistic-gold8mo ago
@Sahil I will be available today https://discord.gg/E4TEgnHV?event=1329840374939914240 From error response of your code you have shared it's look like your have undefined variable and you just need to define it.
genetic-orange
genetic-orange7mo ago
Can variableValues be changed mid-call, e.g. by a tool call? My use case: Squad member 1 talks to caller, gets data, e.g. address Squad member 1 calls tool, which calls PATCH /call/:id to update membersOverrides.variableValues Squad member 1 transfers to Squad member 2 Squad member 2 references the variables Right now this does not work, could you please share the best practice for this?
optimistic-gold
optimistic-gold7mo ago
Hey @choomba please create a new #support ticket .

Did you find this page helpful?