VerveAI
10/09/2025, 11:20 PMVapi Support Bot
10/09/2025, 11:21 PMjs
app.post('/vapi-webhook', (req, res) => {
const caller = req.body.customer?.number;
// Lookup LLM instance based on caller
// Route call logic here
res.json({ assistantId: getLLMForCaller(caller) });
});
Set this endpoint as your assistant or phone number server URL in Vapi to enable scalable, dynamic routing.
Sources:
- [Setting server URLs](https://docs.vapi.ai/server-url/setting-server-urls)
- [Import number from Twilio](https://docs.vapi.ai/phone-numbers/import-twilio)VerveAI
10/09/2025, 11:22 PMVerveAI
10/09/2025, 11:22 PMVapi Support Bot
10/09/2025, 11:24 PMjs
// Twilio webhook handler
app.post('/twilio-incoming', async (req, res) => {
const caller = req.body.From;
// Call Vapi API to start the voice agent
await axios.post('https://api.vapi.ai/call', {
phoneNumberId: YOUR_VAPI_PHONE_NUMBER_ID,
customer: { number: caller },
assistantId: getLLMForCaller(caller)
}, { headers: { Authorization: `Bearer ${VAPI_API_KEY}` } });
res.send('<Response></Response>'); // TwiML response
});
Set /twilio-incoming as your Twilio number's webhook. This lets you scale and route calls dynamically through your backend.
Reference: [Call Handling with Vapi and Twilio](https://docs.vapi.ai/calls/call-handling-with-vapi-and-twilio)
Source:
- [Call Handling with Vapi and Twilio](https://docs.vapi.ai/calls/call-handling-with-vapi-and-twilio)VerveAI
10/09/2025, 11:25 PMVapi Support Bot
10/09/2025, 11:26 PMphoneNumberId.
Once imported, you can use that phoneNumberId in your backend logic to trigger the Vapi agent for each incoming call:
js
await axios.post('https://api.vapi.ai/call', {
phoneNumberId: YOUR_VAPI_PHONE_NUMBER_ID, // unique for each imported number
customer: { number: caller },
assistantId: getLLMForCaller(caller)
}, { headers: { Authorization: `Bearer ${VAPI_API_KEY}` } });
For large-scale setups, consider automating the import process via the [Vapi API](https://docs.vapi.ai/api-reference/phone-numbers/create) to manage many numbers efficiently.
Sources:
- [Phone Calling](https://docs.vapi.ai/phone-calling)
- [Call Handling with Vapi and Twilio](https://docs.vapi.ai/calls/call-handling-with-vapi-and-twilio)VerveAI
10/09/2025, 11:26 PMVapi Support Bot
10/09/2025, 11:27 PMVapi Support Bot
10/09/2025, 11:27 PMVapi Support Bot
10/09/2025, 11:27 PMVapi Support Bot
10/09/2025, 11:27 PMNir Simionovich (CEO@Cloudonix)
10/13/2025, 9:59 PM