Skip to main content

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

  1. You provide a webhook_url when making a call
  2. Call24x7.AI processes the call
  3. When the call completes, Call24x7.AI sends a POST request to your webhook URL
  4. 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 the webhook_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

string
Unique identifier for the call
string
Final call status: COMPLETED, FAILED, or CANCELLED
string
Direction of the call: outbound or inbound
string
Phone number that initiated the call
string
Phone number that received the call
string
ID of the AI agent that handled the call
string
Name of the AI agent
number
Call duration in seconds
string
URL to access the call recording
string
Full conversation transcription
string
Structured data extracted from the conversation (JSON string)
number
Cost of the call in USD

Webhook Security

Verify Webhook Requests

While Call24x7.AI doesn’t currently sign webhooks, you should:
  1. Use HTTPS: Always use HTTPS for webhook endpoints
  2. Validate Source: Verify requests are coming from Call24x7.AI
  3. Idempotency: Handle duplicate webhook deliveries gracefully
  4. Timeouts: Respond quickly (within 5 seconds) to avoid retries

Example: Idempotent Webhook Handler

Webhook Retries

If your webhook endpoint doesn’t respond with a 2xx 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
Always respond quickly to webhook requests to avoid unnecessary retries.

Testing Webhooks

Using ngrok for Local Testing

  1. Start your local server: node server.js
  2. Start ngrok: ngrok http 3000
  3. Use the ngrok URL as your webhook URL: https://abc123.ngrok.io/webhooks/call-complete
  4. 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

  1. Idempotency: Handle duplicate webhook deliveries
  2. Fast Response: Respond within 5 seconds
  3. Error Handling: Log errors but return 200 to prevent retries
  4. Validation: Validate webhook payload structure
  5. Monitoring: Monitor webhook delivery success rates

Troubleshooting

  • 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
  • Respond to webhooks quickly (within 5 seconds)
  • Process webhook data asynchronously if needed
  • Return 200 immediately, then process
  • 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: