Overview
Webhooks allow you to receive real-time notifications when calls complete. This enables you to integrate Call24x7.AI with your existing systems and workflows.How Webhooks Work
- You provide a
webhook_urlwhen making a call - Call24x7.AI processes the call
- When the call completes, Call24x7.AI sends a POST request to your webhook URL
- Your server processes the webhook data
Setting Up Webhooks
Step 1: Create a Webhook Endpoint
Create an HTTP endpoint in your application that can receive POST requests:Step 2: Make Your Endpoint Publicly Accessible
Your webhook endpoint must be publicly accessible via HTTPS. For local development, use a tunneling service:- ngrok:
ngrok http 3000 - localtunnel:
lt --port 3000 - Cloudflare Tunnel: For production deployments
Step 3: Include Webhook URL in Call Requests
Add thewebhook_url parameter when making calls:
Webhook Payload
When a call completes, your webhook endpoint will receive a POST request with the following JSON payload:Payload Fields
Unique identifier for the call
Final call status:
COMPLETED, FAILED, or CANCELLEDDirection of the call:
outbound or inboundPhone number that initiated the call
Phone number that received the call
ID of the AI agent that handled the call
Name of the AI agent
Call duration in seconds
URL to access the call recording
Full conversation transcription
Structured data extracted from the conversation (JSON string)
Cost of the call in USD
Webhook Security
Verify Webhook Requests
While Call24x7.AI doesn’t currently sign webhooks, you should:- Use HTTPS: Always use HTTPS for webhook endpoints
- Validate Source: Verify requests are coming from Call24x7.AI
- Idempotency: Handle duplicate webhook deliveries gracefully
- Timeouts: Respond quickly (within 5 seconds) to avoid retries
Example: Idempotent Webhook Handler
Webhook Retries
If your webhook endpoint doesn’t respond with a2xx status code within 5 seconds, Call24x7.AI will retry the webhook:
- Retry attempts: Up to 3 retries
- Retry intervals: Exponential backoff (1s, 5s, 30s)
- Timeout: 5 seconds per request
Testing Webhooks
Using ngrok for Local Testing
- Start your local server:
node server.js - Start ngrok:
ngrok http 3000 - Use the ngrok URL as your webhook URL:
https://abc123.ngrok.io/webhooks/call-complete - Make a test call with the webhook URL
Using Webhook Testing Tools
- webhook.site: Get a temporary webhook URL for testing
- RequestBin: Create a bin to inspect webhook payloads
- Postman: Use Postman’s webhook testing features
Best Practices
- Idempotency: Handle duplicate webhook deliveries
- Fast Response: Respond within 5 seconds
- Error Handling: Log errors but return 200 to prevent retries
- Validation: Validate webhook payload structure
- Monitoring: Monitor webhook delivery success rates
Troubleshooting
Webhooks not being received
Webhooks not being received
- Verify your endpoint is publicly accessible
- Check that the URL uses HTTPS
- Ensure your server is running and accessible
- Check firewall and security group settings
Webhooks timing out
Webhooks timing out
- Respond to webhooks quickly (within 5 seconds)
- Process webhook data asynchronously if needed
- Return 200 immediately, then process
Duplicate webhooks
Duplicate webhooks
- Implement idempotency checks using call_id
- Handle duplicate deliveries gracefully
- Use a database to track processed webhooks
Examples
Update CRM After Call
Send Notification
Support
For webhook-related issues:- Check the API Reference for webhook configuration
- Visit our Help Center
- Contact support: support@call24x7.ai

