Setting Up a Webhook
Overview
A webhook allows real-time data transfer between web applications. Cellcast provides you with two types of WebHooks for integrating your application. Follow these steps to set up a webhook with Receive URL and Status URL. Both MO (Mobile Originated) and DLR (Delivery Report) can be forwarded to user webhook.
Webhook Configuration
From your dashboard, click to the top right of the page, and there is an API menu in the dropdown.
After that, you go to the API KEYS tab.
Scroll down to Webhook section to start setting up your webhook
1. Receiver Setup
- Receive URL: Specify the URL where your server will receive webhook payloads. On this URL you will receive any responses submitted by your users.
- Example:
https://yourdomain.com/webhook-receiver
- Example:
- Test Send: You can test the receive webhook by providing the payload and sending the request.
Example Data From Receive Webhook
{
"_id": "66b5b93b1e2c012dfe964000",
"status": "delivered",
"type": "receive",
"message": "This is reply message",
"sender": "+61400000000",
"receiver": "+61400000001"
}
Field | Description |
---|---|
_id | message Id |
status | current status of message i.e. "delivered", "received", "expired", "dead", "rejected", "failed" |
type | type of request e.g. "receive" |
message | response from your customer |
sender | sender phone number |
receiver | receiver phone number |
2. Status Setup
- Status URL: Specify the URL to verify and monitor webhook status. On this URL you will receive status of messages sent via Cellcast's API.
- Example:
https://yourdomain.com/webhook-status
- Example:
- Test Send: You can test the status webhook by providing the payload and sending the request.
Example Data From Status Webhook
{
"_id": "66b5b93b1e2c012dfe964000",
"status": "delivered",
"type": "send",
"sender": "cellcast",
"receiver": "+61400000001"
}
Field | Description |
---|---|
_id | message Id |
status | current status of message i.e. "delivered", "received", "expired", "dead", "rejected", "failed" |
type | type of request e.g. "receive" |
sender | sender phone number |
receiver | receiver phone number |
Message Status
The following are the status codes returned in DLRs that our message gateway supports.
Status | Description |
---|---|
delivered | Message has been delivered by the carrier transport |
received | Message has been received |
rejected | The carrier rejected the message |
expired | The carrier was unable to deliver the message in a specified amount of time. For instance when the phone was turned off. |
failed | Message delivery status has failed |
dead | Message has been deleted |
Webhook Security
Cellcast webhooks support authentication through Basic Auth. To enhance security, you can configure the Username and Password for your webhooks. When a webhook is triggered, the request header will include an authorization field like "Authorization": "Basic dGVzdEF1dGhVc2VybmFtZU000000000000000000000000000000". This field contains a Base64-encoded string that combines the username and password, which the receiving server can decode to authenticate the request.