Incoming Call Webhooks

Incoming Call Webhooks

Incoming Call Webhooks allow your application to receive real-time notifications whenever a call is received on your client phone numbers. This enables you to process, route, log, or handle calls programmatically as they arrive.

How It Works

  1. Register a webhook URL in your account.

  2. Each incoming call to your client phone numbers triggers a POST request to the configured URL.

  3. Your server must respond with HTTP 200 OK within 5 seconds to confirm receipt.

Important: The webhook URL must be HTTPS and publicly accessible from the internet.


Register a Webhook URL

Endpoint:

 
POST https://api.zonitel.com/api/v3/calls/webhooks Content-Type: application/json X-Client-Id: 550e8400-e29b-41d4-a716-446655440000 Authorization: Bearer <YOUR_ACCESS_TOKEN>

Request Body (JSON):

 
{ "url": "https://yourdomain.com/api/inbound-calls" }

Notes:

  • URL must be HTTPS and reachable from the public internet.

  • Must respond with HTTP 200 OK within 5 seconds.

Success Response (200 OK):

 
{ "status": "success", "data": { "url": "https://yourdomain.com/api/inbound-calls" }, "message": "Webhook updated successfully" }

Retrieve Registered Webhook

Endpoint:

 
GET https://api.zonitel.com/api/v3/calls/webhooks X-Client-Id: 550e8400-e29b-41d4-a716-446655440000 Authorization: Bearer <YOUR_ACCESS_TOKEN>

Example Response (200 OK):

 
{ "status": "success", "data": { "url": "https://yourdomain.com/api/inbound-calls" }, "message": "Webhook retrieved successfully" }

Webhook Payload Example

When an incoming call is received, your webhook endpoint will receive a POST request with a JSON payload like this:

 
{ "caller_id_name": "John Doe", "caller_id_number": "+14155552671", "destination_number": "+18339664835" }

Payload Fields:

  • caller_id_name: The name of the caller (if available).

  • caller_id_number: The phone number of the caller.

  • destination_number: The client phone number receiving the call.


Common Error Responses

  • 401 Unauthorized

 
{ "code": 401, "message": "Authentication required" }
  • 403 Forbidden

 
{ "code": 403, "message": "Access denied" }
  • 404 Not Found

 
{ "code": 404, "message": "No webhook URL configured." }
  • 500 Internal Server Error

 
{ "code": 500, "message": "An internal server error occurred" }

Best Practices

  • Always use HTTPS for your webhook URLs.

  • Respond with HTTP 200 OK within 5 seconds to acknowledge the call event.

  • Keep your Bearer token secure.

  • Ensure your webhook endpoint can handle multiple concurrent calls.

Was this article helpful?

Still Have Questions?

Our support team is available 24/7 to help you get started

Chat with us on WhatsApp