Gregb
04/11/2025, 3:05 PMVapi Support Bot
04/11/2025, 3:07 PMjavascript
// Your webhook endpoint
@app.post("/twilio/inbound_call", response_class=PlainTextResponse)
async def receive_call_data(
AccountSid: str = Form(...),
// other parameters
ToZip: Optional[str] = Form(None)
):
call_data = CallData(
AccountSid=AccountSid,
// other data
ToZip=ToZip
)
r = requests.post("https://api.vapi.ai/call", json={
"phoneNumberId": "your-phone-number-id",
"phoneCallProviderBypassEnabled": True,
"customer": {
"number": call_data.Caller
},
"assistantId": "your-assistant-id"
}, headers={
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {api_key}"
})
result = r.json()
return result["phoneCallProviderDetails"]["twiml"]
This approach allows you to process the call as needed and then forward it to Vapi using TwiML when required, [according to information found in Discord](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1343397177182912553).
## 2. Use assistantOverrides
with variableValues
You can pass dynamic variables to Vapi using the assistantOverrides
parameter with the variableValues
object:
json
{
"variableValues": {
"name": "CustomerName",
"accountId": "12345",
"otherData": "value"
}
}
Vapi Support Bot
04/11/2025, 3:07 PMbash
curl -X POST 'https://api.vapi.ai/call' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"phoneNumberId": "your-phone-number-id",
"phoneCallProviderBypassEnabled": true,
"customer": {
"number": "customer-phone-number"
},
"assistantId": "your-assistant-id",
"assistantOverrides": {
"variableValues": {
"customerName": "John Doe",
"accountStatus": "Premium"
}
}
}'
## 4. Vapi Web SDK Method
If you're using the Vapi Web SDK, you can override assistant settings or set template variables:
javascript
const assistantOverrides = {
variableValues: {
name: "Alice",
accountType: "Premium",
lastPurchase: "2025-03-15"
},
};
vapi.start("your-assistant-id", assistantOverrides);
[According to Vapi's Web SDK documentation](https://docs.vapi.ai/sdk/web), this is a straightforward way to pass dynamic data.
Is there a specific implementation approach you're interested in exploring further?
Sources:
- [Discord Thread on Intercepting Calls](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1343397177182912553)
- [Discord Thread on Using assistantOverrides](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1335054553250533439)
- [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web)
- [Discord Thread on Webhook Configuration](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1336345690393149452)Gregb
04/11/2025, 3:12 PMGregb
04/11/2025, 3:13 PMPraveen
04/14/2025, 6:13 AMutsav
04/14/2025, 12:58 PM