Webhooks
Webhooks call external HTTP/S services with each message received.
Configuration
In order to create and manage webhooks, open your shiftr.io instance settings and navigate to the "Webhooks" tab. Select an existing webhook to update it, or click "Create Webhook" to create a new one. The following settings are available for webhooks:
- Name: The name of the webhook that is also used as the connection name in the real-time graph.
- Topic: The topic filter to subscribe for messages to relay. Similar like an MQTT topic, it may contain wildcards to match multiple topics.
- URL: The URL of the external service to which messages are sent to.
- Body: The template to construct the HTTP request body.
- Content Type: The content type to send as a header with the request.
- Report Topic: An optional topic for the webhook to send reports about every request. See the format below.
Reports
The webhook may be configured to send reports about each request made as a JSON object to a topic. The messages to the topic have the following format:
{
"topic": "foo",
"response": "Data received!",
"status": 200,
"duration": 0.015,
"error": null
}
topic
: The topic on which the forwarded message is received.response
: The response of the called HTTP service (truncated to 4KB).status
: The returned HTTP response status as an integer.duration
: The duration of the HTTP request in seconds.error
: If available, the error that occurred while making the request.
Modes
The following modes may be selected that define under what circumstances a report is sent:
- All: A report is sent for all requests.
- Failed: A report is only sent for requests that did not a return a status code in the range 200-300.