SMS Webhooks

SMS Webhooks

SMS webhooks POST an event to your server whenever a message is sent, delivered, fails or arrives. This guide shows you the quick way to register one from the Private Integrations screen, the HTTP 200 rule that decides whether it saves, and the API method for doing it in code.

The simple way: set it in the portal

You do not need to call the API to register a webhook. It can be set from the portal in under a minute.

  1. Log in to your Zonitel Office Portal.
  2. In the left sidebar, expand Settings and click Private Integrations.
  3. Open the Webhooks tab.
  4. Under SMS webhook, paste your Webhook URL.
  5. Click Save.

The URL has to be valid and answer with HTTP 200 to be saved — if it does not respond correctly it is not stored, so have your endpoint live before you save. To remove the webhook later, clear the field and save again.

The rest of this article covers doing the same thing through the API, which is what you want if you are provisioning accounts programmatically.


Advanced: method and receiver authentication

  1. Open Advanced under the webhook URL and enable Use a custom method or authentication.
  2. Choose the HTTP method and Authentication your receiving service requires. Methods: POST, PUT, PATCH or GET. Authentication: None, Bearer token, API key, Basic (user + password) or Custom header.
  3. Complete the fields shown for that choice and save the webhook. The receiving URL must respond with HTTP 200 for the portal to accept it.

POST with no authentication is the default. GET has no request body; the event travels as query parameters. For API key, select where to send it and enter the header or parameter name required by your receiver.

The optional receiver credentials belong to the service receiving the webhook. They are separate from the Zonitel API token and X-Client-Id used when your software calls our API. Only provide credentials intended for that receiver.

The API registration example below configures the URL. Use the portal for the Advanced options shown here.

Step-by-step: sms webhook

How It Works

  1. Register a webhook URL in your account.

  2. Whenever an SMS is sent, delivered, failed, or received inbound, Zonitel sends a POST request to your webhook URL.

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

Important: Requests use Bearer Authentication. Include your access token in the Authorization header.


Register a Webhook

Endpoint:

 
PUT https://api.zonitel.com/api/v3/integrations/sms/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/sms-webhook" }

Notes:

  • URL must be HTTPS and publicly reachable.

  • Your server must respond within 5 seconds with HTTP 200 OK.

Example Success Response:

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

Retrieve Registered Webhook

Endpoint:

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

Example Response:

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

Remove the registered SMS webhook

Use DELETE on the same endpoint to stop sending SMS events to your receiver. A successful removal returns HTTP 204.

curl --request DELETE \
  --url https://api.zonitel.com/api/v3/integrations/sms/webhooks \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --header 'X-Client-Id: YOUR_CLIENT_ID'

Webhook Notifications

Inbound SMS Notification

 
{ "status": "received", "data": { "id": "11111111-aaaa-2222-bbbb-333333333333", "segments": 1, "direction": "inbound", "messageText": "Hello, this is a test SMS", "from": "+10000000010", "to": "+10000000020", "medias": [] }, "message": "SMS message received successfully" }

Outbound SMS Status Notification

 
{ "status": "delivered", "data": { "id": "44444444-cccc-5555-dddd-666666666666", "segments": 1, "direction": "outbound", "messageText": "Test outbound SMS with media", "from": "+10000000020", "to": "+10000000030", "medias": [ "https://example.com/media1.jpg" ] }, "message": "SMS message delivered successfully" }

Common Error Responses

  • 401 Unauthorized

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

 
{ "code": 403, "message": "Access denied" }
  • 400 Bad Request

 
{ "code": 400, "message": "Invalid request parameters" }
  • 500 Internal Server Error

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

Best Practices

  • Always use HTTPS for webhook URLs.

  • Respond with HTTP 200 OK within 5 seconds.

  • Keep your Bearer token secure; never share it publicly.

  • Test webhook endpoints regularly to ensure reliable delivery.

Going further

Receiving events is one half of a messaging integration. Sending SMS and MMS, looking up a message, checking remaining capacity and scheduling bulk campaigns are covered in Send and Receive SMS with the API.

Need help?

Call/Text/WhatsApp: (833) 966-4835
Email: info@zonitel.com

Was this article helpful?

Still Have Questions?

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

Chat with us on WhatsApp