Webhooks
You can create, view and delete webhooks via this endpoint. Alternatively, you can manage your webhooks in the webapp in the Developer area.
Show active webhooks
Query the active webhooks of your account.
Request
curl -G "https://gateway.seven.io/api/hooks" \
-H "X-Api-Key: YOUR_API_KEY"
Answer
{
"success": true,
"code": null,
"hooks": [
{
"id": "410",
"target_url": "https://acme.inc/v1/webhooks",
"headers": "",
"event_type": "sms_mo",
"event_filter": "49157123456789",
"request_method": "GET",
"enabled": true,
"created": "2021-03-01 11:19:08"
},
{
"id": "1277",
"target_url": "https://hooks.seven.io/hook",
"headers": "Authorization: Basic dXNlcjpwYXNz",
"event_type": "all",
"event_filter": null,
"request_method": "JSON",
"enabled": false,
"created": "2021-12-30 13:33:02"
},
{
"id": "1808"
// ...
}
]
}
Register webhook
Parameters
- Name
target_url- Type
- string
- Description
Destination address of your webhook
- Name
headers- Type
- string
- Description
Custom headers to be sent to the webhook URL. Could contain multiple headers separated by a line break.
- Name
event_type- Type
- enum
- Description
Type of event for which you would like to receive a webhook.
Show events
all- Sends all events
rcs- RCS events and inbound RCS messages
sms_mo- New inbound SMS
wa_mo- New inbound WhatsApp message
dlr- Status reports of your SMS
voice_call- Info about voice calls
voice_status- Status updates of voice calls
voice_dtmf- Incoming DTMF signals in voice calls
tracking- Clicks or views of the Performance Tracking
- Name
event_filter- Type
- string
- Optional
- Optional
- Description
Optional. Only used for
sms_mo: the inbound number in international format without plus, e.g.4915112345678. The webhook is only sent for inbound SMS to this number, e.g. to route different inbound numbers to different URLs.For all other event types, leave this field empty. It is not evaluated there and a set value prevents delivery of the webhook.
- Name
request_method- Type
- enum
- Optional
- Optional
- Description
Request method in which you would like to receive the webhook.
POST - Data is sent as an HTTP POST request as application/x-www-form-urlencoded (default)
GET - Data is sent as HTTP GET parameter
JSON - Data is sent via HTTP POST as JSON payload
Request
curl -X POST "https://gateway.seven.io/api/hooks" \
-H "X-Api-Key: YOUR_API_KEY" \
-d "target_url=https://acme.inc/webhook/" \
-d "event_type=all"
Request (inbound SMS filtered by number)
curl -X POST "https://gateway.seven.io/api/hooks" \
-H "X-Api-Key: YOUR_API_KEY" \
-d "target_url=https://acme.inc/webhook/sms" \
-d "event_type=sms_mo" \
-d "event_filter=4915112345678"
Answer
{
"success": true,
"code": null,
"id": 12345,
"error_message": null
}
Delete webhook
Call the API with the same parameters with which the webhook was created (target_url,event_type,request_method) to delete it again. Alternatively, you can delete a webhook directly via the respective ID. To do this, enter the parameter id.
You will receive the same return as when creating the webhook.
Parameter (delete per ID)
- Name
id- Type
- integer
- Description
The ID of the webhook you want to delete.
Request
curl -X DELETE "https://gateway.seven.io/api/hooks" \
-H "X-Api-Key: YOUR_API_KEY" \
-d "id=123456"
Answer
{
"success": true,
"code": null,
"id": 12345,
"error_message": null
}