multiple-amethyst
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
Vapi Support Bot
Vapi Support Botโ€ข3mo ago
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:
{
"customer": { "number": "+123132213" },
"assistantId": "xxxxx",
"phoneNumberId": "xxxx",
"assistantOverrides": {
"variableValues": {
"name": "Felix",
"email": "felix@felix.com",
"company": "super duper company",
"referrer": "google"
}
}
}
{
"customer": { "number": "+123132213" },
"assistantId": "xxxxx",
"phoneNumberId": "xxxx",
"assistantOverrides": {
"variableValues": {
"name": "Felix",
"email": "felix@felix.com",
"company": "super duper company",
"referrer": "google"
}
}
}
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 ๐Ÿฅ
Duckie
Duckieโ€ข3mo ago
Message marked as helpful by @Felix! ๐ŸŽ‰
multiple-amethyst
multiple-amethystOPโ€ข3mo ago
Perfect, that worked smoothly. thanks for the super fast reply!
wise-white
wise-whiteโ€ข3mo ago
Glad it fixed

Did you find this page helpful?