This tutorial covers how to send an alert using Rules and webhooks. If you're looking for an overview of the Rules tab in UrsaLeo Cloud, start here. Webhooks are used to send a message to a specific URL. To demonstrate, we will send a Slack message triggered by an incoming sensor value via the popular API interface app, Zapier.
The first step is to generate a URL. To do this, you will need to create a Zapier account (www.zapier.com) and click Make a zap! You then get common Zap actions to choose from as a trigger:
Select Webhooks and the Catch Hook option:
Save and continue presents a screen where you can copy the URL to be used in the rule:
Create your rule in the Rules tab of UrsaLeo Cloud. Select your conditions, name your rule, and select Webhook under Action. Paste the URL from Zapier in the To field.
Then test the webhook by firing (testing) the rule and making sure Zapier is receiving it (click the OK I did this button after firing the rule):
Finally, we define an action for Zapier to take. In this example, we want to send a Slack message. Zapier guides you through connecting your Slack account and provides a template:
Variables can be included in any Zapier action. They are picked up by the webhook. Simply select the template for the Slack message (or email or whatever it is you are sending to) and click on the relevant variable. Here's a screen shot of the list from the default Thunderboard 2 sensor board. Note: This field list is generated by the test webhook.
Then save the Zap (and make sure you turn it on)! Voila!