This endpoint allows you to create, view and delete webhooks.
Please send the request to the following URL:
https://gateway.sms77.io/api/hooks
No other parameters are required for the query apart from your authentication data. The return is in JSON format.
Required parameters
Parameters | Description | Examples |
---|---|---|
action | The action to be performed | read – Lists all active webhookssubscribe – Create a webhookunsubscribe – Delete a webhook |
Register Webhook
Parameters | Description | Examples |
---|---|---|
target_url | The target URL of your webhook | https://your-domain.com/webhook |
event_type | The type of event for which you would like to receive a webhook |
all – Sends on all events.dlr – Status reports of your SMS.sms_mo – New inbound SMS.tracking – Clicks / views of the performance tracking.voice_call – Info regarding incoming voice calls.voice_status – Updates of the voice call status.
|
event_filter | Optional – sends the webhook only if the filter applies. For example, for different webhooks with different inbound numbers. | 4915126716517 |
request_method | The request method in which you want to receive the webhook | POST – You receive webhooks as HTTP POST request as application/x-www-form-urlencoded (default)GET – You receive webhooks as HTTP GET requestJSON – You receive webhooks as JSON payload via a HTTP POST request |
Example
https://gateway.sms77.io/api/hooks?p=YOUR_API_KEY&action=subscribe&target_url=https%3A%2F%2Fyour-domain.com%2Fwebhook&event_type=sms_mo&request_method=GET
In case of success you will receive the following data:
{
"success": true,
"code": null,
"id": 12345
}
Delete Webhook
Call the API with action=unsubscribe and the same parameters used to create the webhook (target_url
, event_type
, request_method
) to delete it. You will get the same return as when you created the webhook.
Alternatively, you can delete a Webhook directly using the respective ID and without target_url
, event_type
, request_method
. To do this, specify the parameter id
.
You get the same return as when you created the webhook.
Example
https://gateway.sms77.io/api/hooks?p=YOUR_API_KEY&action=unsubscribe&id=123
Or:
https://gateway.sms77.io/api/hooks?p=YOUR_API_KEY&action=unsubscribe&target_url=https%3A%2F%2Fyour-domain.com%2Fwebhook&event_type=sms_mo&request_method=GET
{
"success": true,
"code": null
}
Read Webhooks
Use the parameter action=read to read out all current webhooks of your account.
Example
https://gateway.sms77.io/api/hooks?p=YOUR_API_KEY&action=read
{
"success": true,
"code": null,
"hooks": [
{
"id": "23",
"target_url": "https:\/\/your-domain.com\/webhook",
"event_type": "sms_mo",
"event_filter": null,
"request_method": "POST",
"created": "2020-11-04 13:49:16"
}
]
}
Example Requests
Let us show you how the actual requests look like when they receive on your target URL.
Inbound SMS (sms_mo)
{
"data": {
"id": "681590",
"sender": "SMS",
"system": "491771783130",
"text": "Hello. I am an example for demonstrating a webhook payload.",
"time": "1605878104"
},
"webhook_event": "sms_mo",
"webhook_timestamp": "2020-12-02 11:55:44"
}
SMS status report change (dlr)
{
"data": {
"msg_id": "77149843739",
"status": "TRANSMITTED",
"timestamp": "2021-08-24 08:08:00.000000"
},
"webhook_event": "dlr",
"webhook_timestamp": "2021-08-24T08:08:00+02:00"
}
Voice call status update (voice_status)
{
"data": {
"callerId": "491771783130",
"duration": "4",
"id": "284195",
"pricePerMinute": 0.075,
"recipient": "4943160049851",
"status": "completed",
"timestamp": 1629786769
},
"webhook_event": "voice_status",
"webhook_timestamp": "2021-08-24T08:32:50+02:00",
}
Performance Tracking (tracking)
{
"webhook_event": "tracking",
"webhook_timestamp": "2022-07-27T07:38:18+02:00",
"data": {
"sms_id": "77184244925",
"sms_label": null,
"tracking_url": "https://ul.gl/EUGClu",
"final_url": "https://www.google.de",
"type": "click",
"total_clicks": 1,
"total_views": "0"
}
}