multiple-amethystโข3mo ago
Add custom attributes to CALL api objects e.g. email-address, name of the customer
I am trying to add more attributes to the assistant by adding them to the customer object. I want to use these attributes then in the assistant like {{customer.email}}.
it seems not to work, and I get an error message sending them. This is what the body looks like which I send to https://api.vapi.ai/call:
{
"customer": {
"name": "Felix",
"number": "+123132213",
"email": "felix@felix.com",
"company": "super duper company",
"referrer": "google"
},
"assistantId": "xxxxx",
"phoneNumberId": "xxxx"
}
What am I doing wrong? or is it not possible?
I asked the support bot on vapi.ai and it suggested to do it this way ๐
Thanks for any help!
4 Replies
You can't add custom fields like
email
or company
directly to the customer
object in the /call
API request. Instead, put your custom attributes inside assistantOverrides.variableValues
and reference them in your assistant as {{email}}
, {{company}}
, etc.
Example:
This should resolve the error and let you use those variables in your assistant prompts.
Sources:
- Vapi Docs: Dynamic Variables
- Vapi Docs: Personalizationโคต๏ธ Mention @Vapi Support Bot for follow-ups ๐ฅ
Message marked as helpful by @Felix! ๐
multiple-amethystOPโข3mo ago
Perfect, that worked smoothly. thanks for the super fast reply!
wise-whiteโข3mo ago
Glad it fixed