Connect your voice agents to any CRM, calendar, or backend system using webhooks.
When you define tools/functions for your voice agent, the AI will call your webhook URL whenever it needs to perform an action (like booking an appointment). Your webhook receives the function name and arguments, performs the action, and returns a result that the AI speaks back to the caller.
Caller: "I'd like to book an appointment for tomorrow at 3pm"
↓
AI collects: name, phone, date, time, reason
↓
AI calls your webhook: book_appointment({...})
↓
Your system: Creates calendar event, returns confirmation
↓
AI speaks: "I've booked your appointment for tomorrow at 3pm"Your webhook receives a POST request with this JSON structure:
{
"type": "function_call",
"call_id": "CA1234567890abcdef",
"function": {
"name": "book_appointment",
"arguments": {
"patient_name": "Jonathan",
"date": "2025-12-30",
"time": "15:00",
"reason": "back pain",
"phone": "555-456"
}
}
}| Field | Description |
|---|---|
| type | Always "function_call" |
| call_id | Unique identifier for the phone call |
| function.name | The function being called (e.g., "book_appointment") |
| function.arguments | Object containing the parameters collected from the caller |
Your webhook should return a JSON response with a result field. This text will be used by the AI to respond to the caller.
{
"result": "Appointment confirmed for December 30th at 3:00 PM. We'll send a reminder to 555-456."
}Important: The AI will use your response text naturally in conversation. Write it as you'd want it spoken, not as a system message.
Zapier is a great way to connect your voice agent to 5000+ apps without coding.
Because the payload uses nested objects, use these paths in Zapier:
| Data | Zapier Path |
|---|---|
| Function name | function__name |
| Patient name | function__arguments__patient_name |
| Date | function__arguments__date |
| Time | function__arguments__time |
| Phone | function__arguments__phone |
| Reason | function__arguments__reason |
Tip: In Zapier, you may need to use the "Code by Zapier" step to parse the nested JSON if direct field mapping doesn't work. Use JavaScript to extract:inputData.function.arguments.patient_name
To create calendar events from voice appointments:
Only continue if function.name equals "book_appointment"
Combine date and time: {{date}}T{{time}}:00
Title: {{patient_name}} - {{reason}}
Start: {{formatted_datetime}}
Description: Phone: {{phone}}
Here's a simple Express.js webhook handler:
app.post('/webhook/voice', async (req, res) => {
const { type, call_id, function: func } = req.body;
if (type !== 'function_call') {
return res.json({ result: 'Unknown request type' });
}
const { name, arguments: args } = func;
switch (name) {
case 'book_appointment':
// Save to your database
await db.appointments.create({
patientName: args.patient_name,
phone: args.phone,
date: args.date,
time: args.time,
reason: args.reason,
callId: call_id
});
return res.json({
result: `Appointment booked for ${args.date} at ${args.time}`
});
case 'check_availability':
// Query your calendar
const slots = await getAvailableSlots(args.date);
return res.json({
result: `Available times: ${slots.join(', ')}`
});
default:
return res.json({ result: 'Function not implemented' });
}
});When creating an agent, you can use these pre-built function templates:
check_availability - Check open appointment slotsbook_appointment - Book a patient appointmentcancel_appointment - Cancel an existing appointmenttake_message - Take a message for staffcheck_table_availability - Check table availabilitymake_reservation - Book a tableget_menu_info - Answer menu questionsschedule_consultation - Schedule attorney consultationtake_message - Take message for attorneyMake sure your webhook URL is publicly accessible (not localhost). Test with a tool like webhook.site first.
Ensure your function descriptions clearly explain when to use them. The AI decides based on the description.
Use double underscores for nested paths: function__arguments__date
Make sure your webhook returns {"result": "..."} with natural language the AI can speak.