Zapier is a service that lets you automate tasks between web applications. Connecting a Xively trigger to Zapier lets your Xively feeds send a tweet with Twitter, activate a call or SMS with Twilio, or influence any number of web apps - see Zapier’s directory for more.
This tutorial will help you connect Xively triggers and Zapier. Xively triggers can be fired when the value of a channel matches certain criteria. For example, if a channel goes above or below a certain value, or freezes for some time, or is updated, you can set a trigger to fire. A trigger fire takes the form of an HTTP “Post”, which is what Zapier’s free accounts accept - perfect! If you don’t know about HTTP Posts, that’s no problem - read on to find out how to tie triggers to the services Zapier exposes …
Setup a Zapier Zap to Act when Your Trigger Fires
- Go to www.zapier.com and sign in. (Create a free account if you don’t have one)
- Click the button to
- Make the Trigger Service (left side of zap) a ‘Web Hook’ - then select ‘Catch Hook’
- Choose the ‘Action Service’ side of your Zap. This could be anything but an email is a good way to test things out.
- Click continue, you will be given a webhook URL. Copy this and keep it handy.
- Keep this tab open, but return to the Xively workbench. We’re going to come back here in a minute.
Setup a Xively Trigger to Activate Zapier
- Go to the Xively device that you would like to create a Trigger for
- On the Xively workbench, click
- Add the details of the trigger that will activate your Zapier action
- Enter the URL of the Zapier webhook as the HTTP POST URL. This will arrange for the Xively trigger to be sent to Zapier.
- The trigger is set up! Let’s go back to our Zapier tab.
Connecting Xively to Zap
- Go back to Zapier, click continue.
- There are options to filter the JSON coming from Xively. This can be very useful if you want to send the entire Xively Post. If you are just looking for a few data values, go to the next step.
- Next you fill in the details of the interaction you desire, this can vary greatly depending on what the other side of your Zap is. Some Zaps require additional setup, authorization, and/or API keys.
Any field which has a globe in the top right corner can be filled with parsed JSON values. Clicking the globe in the top right will open a list of parsed JSON keys. Selecting one of these keys will insert the value for that key at a specific place in the text box. This allows you to create rich messages and notifications with text and data.
Take this code and run!
Now that you have a Xively trigger activating a Zapier zap, try out a few new ones!
Or try building an entire network of devices with triggers – it’s a great way to quickly mock up advanced messaging and trigger capabilities in a finished product.