A webhook is a method of augmenting or altering the behavior of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application.
To set up an Ubidots webhook, go the the Events tab in your Ubidots account:
Then create a new event by selecting "+" to set up the webhook:
Select the Variable that will trigger the event once the condition(s) is(are) met.
Ubidots lets you set up the conditions of the Event in three ways:
Value, Has been Inactive, or Position:
Upon completing the condition setup, head to the next step, Actions, and select the webhook option to interact with a 3rd party web services:
Now, you just need to set up the webhook based on the 3rd party web service recipient's API.
The parameters required in the setup of a webhook are:
URL: This is the server endpoint that will receive the webhook payload.
Method: This is the HTTP method of the request made upon the event trigger. Allowed methods are GET, HEAD, DELETE, POST, PUT and PATCH.
Headers: headers of the request. This may include the content-type or the authentication of the request.
In the right panel, you then need to build your message based on the expected format of the 3rd party service. Most commonly, web services expect JSON payload, but URL encoded or other specific data frames my apply as well.
Use the bookmark variables to fill your payload with the information of the device, variable or value that trigger the events
You can set the BACK TO NORMAL payload as well, which will send another webhook once the variable that triggers the events comes back to usual values outside the triggering condition.
Also, in this panel, you can set up the "Repeat action" option, that will send consecutive webhooks in a time period basis while the event condition is still active (up to a maximum of 50 repetitions).
IMPORTANT NOTE: Often, 3rd party web services implement firewall restrictions on which external services, such as Ubidots, can access their resources through webhooks. In those cases, it is necessary to add the external service IP address to the recipient firewall rules to avoid webhook request rejection. The following is Ubidots' pool of IPs used to generate the webhooks, so make sure, if needed, to add it to the respective firewall rules.