Webhooks are HTTP notifications which notify third-party web based applications whenever a specific event occurs. For example, sending a Webhook to another system whenever someone interacts with one of your thyngs.
Sending a Webhook will not make anything happen in another system, you need to write code to listen for, and react to the Webhook. For testing purposes, a site like http://requestb.in may be useful to forward your Webhooks to, this will allow you to view the data which is sent by our Webhooks without the need for you to implement a full listener service.
The first step is to configure a new Integration.
Go to MyThyngs > Developer > Integrations
Each integration allows you to setup authorisation and a base URL to send Webhooks to. If you wish to send your Webhooks to multiple domains, you will need to create multiple integrations. You can also set the format of this integrations webhooks (e.g. XML or JSON).
Webhooks use basic tokenised authorisation. The application that receives the Webhook will need to check the Authorisation header to ensure it contains the correct authentication token. You can reset your authentication token at any time at MyThyngs > Developer > Integrations
Next, create your first Webhook Trigger.
Go to MyThyngs > Developer > Webhooks
Webhooks can be sent when different events occur on Thyngs platform. You can also define the URL where the Webhook should be sent to.
You can view a list of sent Webhooks at MyThyngs > Developer > Queue. In some cases, Webhooks will fail to send. This could be because of invalid authentication or an incorrect URL being configured. If this happens you can resend a failed Webhook on the Queue page.
Webhooks are sent as HTTP POST requests. The URL which the Webhook is sent to will need to handle the HTTP headers in the request.
- Content-Type & Content-Length: Standard Headers, which you may need to parse to determine the format and length of the data.
- Item-Name: The name of the Item in MyThyngs E.g. “Interaction”, “Project”.
- Event-Name: The name of the action that triggered the webhook to be sent. E.g. “Update” or “Create”.
The content of the message is formatted as specified in the Content-Type header, dependant on the type you defined or the integration in MyThyngs e.g. JSON/XML.