Add custom attributes to CALL api objects e.g. ema...
# support
f
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!
v
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:
Copy code
json
{
  "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](https://docs.vapi.ai/assistants/dynamic-variables) - [Vapi Docs: Personalization](https://docs.vapi.ai/assistants/personalization)
v
Message marked as helpful by @Felix! 🎉
f
Perfect, that worked smoothly. thanks for the super fast reply!
k
Glad it fixed