Webhook

Webhooks are user-defined HTTP callbacks. If the user sets up a webhook for an event, and that event occurs, the platform fires a webhook to inform the user and to get verification. Learn more about webhook and its functions here.

Webhook communication is made by sending an HTTP request from the Dexatel Platform to a user’s application. When an event occurs in the Dexatel Platform an HTTP request, that might contain user data relating to the event, is triggered. This HTTP request is sent to the user’s application’s endpoint. This is the endpoint set by the user for webhook requests to be sent to. The endpoint is often referred to as the webhook URL.

Webhook endpoints are meant to configure the webhooks of the account.

Method: Create

Operation creates a new webhook for the account. There can be only one webhook for each event type.

URL /v1/webhooks
Method Type POST
Authorization API Key
Request Content-Type JSON
Response Content-Type JSON

Headers

Name Type Description Status
X-Dexatel-Key string API key Required

Request Body

Name Type Description Status
data object

Details

(see data object below)
Optional
data object
Name Type Description Status
url string Payload URL to which the webhook request is sent Required
event string Event type for which the webhook is fired.
Possible values:
• message - the webhook will be fired in case of an inbound message
• delivery - the webhook will be fired in case of an available delivery report
Required
secret string Webhook secret to sign the payload Optional

Response Parameters

Name Type Description Status
data object

Details

(see data object below)
Optional
data object
Name Type Description Status
id string Unique identifier of the webhook Optional
account_id string Unique identifier of the account Optional
url string Payload URL to which the webhook request is sent Optional
secret string Webhook secret to sign the payload Optional
event string Event type for which the webhook is fired.
Possible values:
• message - the webhook will be fired in case of an inbound message
• delivery - the webhook will be fired in case of an available delivery report
Optional
create_date string Creation date of the webhook in UTC, formatted as yyyyMM-dd HH:mm:ss Optional
update_date string Update date of the webhook in UTC, formatted as yyyyMM-dd HH:mm:ss Optional
links object

Details

(see links object below)
Optional
links object
Name Type Description Status
self string URL of the webhook Optional
account string URL of the account Optional

Example of request body

POST: /v1/webhooks
X-Dexatel-Key: 94d2f2f2884848bca861264ad86d8ace
Content-Type: application/json

                
                        

Example of response body

status - 201

                
                        

Error Codes

The following error codes are returned in response to a user’s request which contains bad syntax or cannot be fulfilled.

Code Description
1201 Webhook is not found
1202 No Webhook found for the account
1203 'data' is required
1204 'data.url' is required
1205 data.secret' is required
1206 'data.event' is required
1207 'data.event' values should be in: [MESSAGE, DELIVERY]
1208 'data.url' is too long