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 (payload)
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
hlr- Results of async HLR lookups (payload)The payloads of all events with examples are described on the Webhooks page.
- Name
event_filter- Type
- string
- Optional
- Optional
- Description
Optional. The webhook is only sent for events whose filter value matches exactly, e.g. to route different inbound numbers to different URLs. Which value is compared depends on the event type:
sms_mo- your inbound number the SMS was sent to (system) in international format without plus, e.g.4915112345678. For inbound SMS with a keyword on a shared number, the keyword is compared instead.
wa_mo- the ID of your WhatsApp service that received the message (system), e.g.WA-1A2B3C4D
voice_call- your inbound number that was called (system)
rcs- your agent ID (agent_id) for incoming messages and typing indicators (IS_TYPING)Status reports (
dlr,voice_statusand RCS status reports such asDELIVEREDorREAD),voice_dtmf,tracking,hlrand replies to your outgoing SMS carry no filter value. A webhook with a filter does not receive these events, so leave the field empty for them. With the event typeall, a set filter applies to all events in the same way.
- 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
}