Using {{customer.X}} variable in API
# support
d
Hi guys, I am trying to send a custom value (company name) using {{customer.X}} This is my json: { "assistantId": "xxx", "assistantOverrides": { "variableValues": { "custom_json": {{17.json}} } }, "customer": { "number": "{{20.phone}}", "name": "{{20.full_name}}", "company_name": "{{20.company_name}}" }, "phoneNumberId": "xxx" } However getting an API error: Error: 400 Bad Request {"message":["customer.property company_name should not exist"],"error":"Bad Request","statusCode":400} This is my variable in VAPI script: Hello is this {{customer.name}} from {{customer.company_name}}? Please could you advise what the issue is and how to fix it? Thanks a lot!
s
This is not being done correctly. 1. The customer object really can have 5 properties. I upload a screenshot of the options available for the customer object. You can view them here at the bottom of the Request Body section: https://docs.vapi.ai/api-reference/calls/create property company_name is not one of those options. https://cdn.discordapp.com/attachments/1344652901791961211/1344664910508064768/image.png?ex=67c1bc49&is=67c06ac9&hm=0d7716760235704568b745e1dbb9bd54f90571266f0ac8bb77379538f30dc513&
In the system prompt, if you have: {{customer.name}} & {{customer.company_name} This is incorrect. You should change them to be: {{name}} & {{companyName}} In the system prompt. Your variable values must have: variableValues: { name: customer.name, companyName: customer.company_name } or however your customer object is built in your code.
Then if you add another variable in your prompt like {{companyAddress}} You would address it like this:
d
I solved it. Thank you so much for your help, its much appreciated.
s
Marking this ticket as Solved ✅