Vapi Support Bot
04/03/2025, 1:56 PMassistant-request
event:
1. Access the phone number with extension from the request body:
python
# Get the "To" phone number from the request body
request_body = request.json # or however you access the request body
To = request_body.get("To", "") # This will contain "+123456789,4321"
[Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1343574701909344297)
2. Extract the extension - While I don't have the exact code, the format is known to be a comma-separated value. You could use string manipulation to extract it:
python
# Example of how you might extract the extension
if "," in To:
phone_number, extension = To.split(",", 1)
# Now extension would contain "4321"
3. Return an assistant based on the extension by adapting this server endpoint example:
javascript
import express from 'express';
const app = express();
app.use(express.json());
// Map extensions to assistant IDs
const EXTENSION_MAPPING = {
'4321': 'assistant-id-for-4321',
'5678': 'assistant-id-for-5678',
// Add more mappings as needed
};
app.post('/assistant-request', (req, res) => {
const To = req.body.To || '';
let extension = '';
// Extract extension if present
if (To.includes(',')) {
extension = To.split(',')[1];
}
// Get the appropriate assistant ID based on extension
const assistantId = EXTENSION_MAPPING[extension] || 'default-assistant-id';
res.json({ assistantId });
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});
[Source](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341224148667600976)Vapi Support Bot
04/03/2025, 1:56 PMSahil
04/06/2025, 11:49 AMSahil
04/06/2025, 11:55 AMSahil
04/08/2025, 10:54 PM