IF - THIS - THAN - THAT of IFTTT is a service aggregator that connects physical and digital services to each other.
- Go to ifttt.com and sign up.
- Download the app on the from apple/ google app store. The app greatly extends the functionality of the services through location services, notifications etc..
There are a number of applets or ‘recipes’ that are already built by the users, and IFTTT also have some curated lists
- We will create an applet from scratch.
- Click ‘my applets’ at the top: This page lists all of your applets, and the ‘Activity’ tab shows when these applets were activated.
- Click ‘new applet’ to create a new one.
The applets consist of triggers and actions
- ‘This’ refers to an event triggered by a service, device etc..
- Click on the + sign to chose a service that can trigger events
IFTTT has a large catalog of services.
- Some of them are built-in; like date&time
- Some of them depend on the IFTTT app, like the location based events
- And some of them depend on external services that need to be authorized
- Browse through the catalog to have a glimpse of the existing services
- Choose ‘Weather Underground’ as your trigger, give permission to the service (popup) and configure the location
- Browse through the available 'triggers', for this example; let's choose 'Current condition changes to'
- Most triggers can be customised - choose 'Snow' and create the trigger
Now we have a trigger - every time it starts snowing in your location, your applet will receive an API call - a trigger- from WeatherUnderground.com. Let's finish the applet by connecting the trigger to an action.
- Click on 'that' - you will be presented with the action services
- Let's choose Google drive ( hint: use 'search' )
- We would like to log every time it starts snowing at our location, so choose 'Add row to spreadsheet'
- Actions can be customised as well - and they can further use the 'ingredients' that come along with the triggers.
- In our case, the 'Current condition changes to' trigger has a bunch of ingredients like the temperature, the condition, the url for the condition icon etc.
- Once you are satisfied with your action, finalize your applet.
- From now on, everytime it stats snowing, WeatherUnderground will send a trigger to IFTTT; which will record the time & date and the temperature to your google sheet.
- HINT: Applets can be turned on /off
The triggers and actions on IFTTT's service catalog are curated, and the integration of new products and services requires specific agreements between the companies and IFTTT.
But there is one way around it - which is specifically designed for 'Makers' and conveniently named as the 'Maker' channel - which allows anyone to develop triggers and actions for their personal use.
Let's make an applet using a trigger from the Maker channel. The procedure is basically the same as above
- Create a new applet, and select the Maker channel
- There is only a single option for the triggers - receive a web request
- Finalize the trigger by giving a meaningful name to your event - you will use this specific name later on to trigger your applet.
- Choose the notification service - for this, you will need the IFTTT app on your phone
- The triggers that come from the Maker channel also has some ingredients. These are the EventName (the one we defined in the prev. stage), OccuredAt (the timestamp) and three variables that are called Value1-2-3
- These are the optional variables we can use for our specific purposes later on
- Create an action that says {{Value1}} sent an event at OccuredAt and finalize your applet
- To put it simply, the maker channel triggers are URLs that can be activated remotely. They require an 'API key' that helps IFTTT to distinguish and redirect the incoming triggers to their respective owners. These API calls can be done from anything/ anywhere that has internet access, but for basic purposes IFTTT provides a simple webpage that helps developers to test the actions.
- Click on your username, then services
- Choose Maker, and click on the settings on the top right
- On this page, you will find the URL that will trigger your events on the IFTTT
- Copy the URL and open it on a new browser window
- You now have the access to the basic test page for your Maker channel triggers
- Click on the bold {event} field, and write "event_test" - the name of the event we have defined earlier...
- The three optional values can be used for different purposes. In our applet, the notification will use the 'variable1' in the notification text
Once you are satisfied with it, go ahead and click the 'Test it' button
Usually in about a few seconds, you will receive a notification on your phone ( For the first time use, it might take a couple of minutes..)
You can also see when it was triggered on the activity tab
You can also copy paste the text that starts with 'curl' to terminal and activate the trigger
This complete URL can be used to trigger events from multiple sources, like microcontrollers or web services. in the following tutorials, we will see some of these options.
Comments