How to Create Geographic Event Triggers with Your Smartphone and IFTTT

Wouldn’t it be great if the mere movement of your smartphone from one location to another could trigger events like thermostat adjustments, notifications, or other automated responses? ? With a little GPS magic and some IFTTT recipes it can. Read on as we show you how.

What Is Geofencing and IFTTT?

To understand just how techno-magic the tricks we’re about to outline are, it helps to understand what exactly geofencing and IFTTT are. While complicated at first glance (and in the case of IFTTT a little bit indecipherable) they’re much easier understood via example.

Last week we dug extensively into the concept of geofencing in HTG Explains: What Geofencing Is (and Why You Should Be Using It) but here’s a concise summary. Geofences are invisible boundaries created by a combination of hardware (such as the GPS chip in your smartphone) and software (such as the mobile operating system and additional applications layered overtop) such that some event or action is triggered when the hardware passes into, out of, or lingers in the designated geofence zone. If you’ve installed an application on your child’s phone that notifies you when they arrive and leave their school or a to-do list that reminds you to buy milk when you’re driving by the store, for example, you’ve used a geofence-based application.

IFTTT is a web-based service introduced in 2011 designed to make setting up conditional statements that in turn trigger events as close to drag-and-drop simple as possible through a simple recipe creation system. The IFTTT acronym stands for “If This Then That” and the service both hosts thousands of recipes and allows you to create your own recipes that combine if-this-then-that in a novel way like “If rain is forecasted then send a notification to my phone so I don’t forget an umbrella” or “if I post an update on my business Twitter account then automatically repost that update to my business Facebook account,” and so on. While IFTTT can’t do everything, the number of services and devices IFTTT is integrated is pretty vast and you can create recipes for all manner of things.

While there are thousands of recipes that don’t involve your smartphone, involving your smartphone via the IFTTT mobile application is a recipe for some really clever location-based triggers that effectively combine geofences (where you are, where you’ll be, or even where you’ll be passing by or through) with the vast number of services IFTTT can access.

Let’s take a look at how to take advantage of geofence-based triggers and notifications on your smartphone.

Using Geographic Triggers with IFTTT Mobile

The first order of business is to, if you don’t have one already, sign up for an IFTTT account by visiting the IFTTT portal here. Although you can create an account and begin searching for recipes on the IFTTT application, the mobile application isn’t as flexible and easy to work with as the web interface so we recommend using the web interface for as much of the setup work as possible.

The only step you need to complete on the smartphone itself is to activate the Location Channel (more on that in a moment) because it requires local permissions to access the GPS/Wi-FI information on the device.

Installing and Configuring the App

You can find the IFTTT application on both the Google Play Store and the Apple App Store. Download the application to you device and launch it. Either enter your login credentials (if you already signed up on the web site or have an existing account) or create a new account now.

All the services, apps, and other components of the IFTTT recipes are contained in “channels”. The core of all recipes can be described as (If this channel’s input = X) Then (Output predetermined Y from this channel).

As such we need to subscribe to the Location channel for our respective smartphone operating system. We can enable everything else from either the phone or our web browser later, but you have to authorize the permissions on-device.

The interface can be a tad bit tricky if this is your first time using the app. To add a channel from the device open the app, tap on the little mortar and pestle icon (seen in the image above) then, in the resulting “My Recipes” menu, tap on the little gear in the lower right corner to access the Settings menu. Within the settings menu you’ll see an entry for “Channels”.

Simply tap on that, search for “location” to pull up entries for “Android Location” and “iOS Location” and then select the appropriate one for your device OS. You’ll be prompted to authorize the channel to use your device’s location data and then you’re all set.

Looking Up Recipes

Now that our device can share location data with the IFTTT system it’s time to start looking for location-based recipes. You may not find the exact recipe you’re looking for (and that’s OK) but we highly recommend at least browsing through the recipe database for a few minutes.

Why look at other recipes first? Not only will you see interesting ways that people are using location and IFTTT (“Oh wow I didn’t know you could use IFTTT with the Smartthings hub!”) but you’ll also get a chance to peek inside the published recipes and see how exactly people configured them.

Everytime we look at the IFTTT recipe database we’re always impressed by some new and novel way people are using the service.

Creating Your First Recipe

There are an abundance of recipes in the IFTTT catalog but that doesn’t mean that every possible contingency is covered (not by a longshot). Let’s take a look at how to create your own IFTTT recipe for custom alerts, notifications, and triggers.

Currently there’s no way to craft a recipe through the IFTTT mobile app so we need to head over to the web site.

Log into the site and select “Create” under your username in the upper-right corner or jump right to the new recipe screen with this link. Tap on the underlined “this” text in the very large “ifthisthenthat” text on the screen to start the process.

The first step is to choose a trigger channel. You can mess around with the hundreds of input channels later to create all kinds of non-location-aware recipes, but right now the ingredient we crave is geo-location. Type in “location” in the channel search box to narrow it down and then select either Android or iOS location based on your mobile device.

The next step is focused on what kind of trigger you want. Entering an area? Leaving an area? Both?

What we select really depends on what we want to accomplish, so it’s time to decide what kind of results we’re cooking up with this recipe. Let’s say we work in downtown Chicago and we have an irregular work schedule, a lengthy commute, but despite that our spouse likes to eat dinner with us when we get home. Wouldn’t it be nice if they were automatically notified when we left the office so they had a good idea how long it would be before we arrived home? To start building such a recipe we’ll select the “You exit and area” trigger as we only want the text message to send when we leave and not when we enter the designated area.

Step 3 is to set the geofence. You can pick an address and then zoom in very close (to set the boundary as tight as within the office building or block the office building is located on) to as broad as the city itself or greater geographic region.

We’ve got the “If” part set up “If we leave the geographic boundary around 200 Whacker Dr. in Chicago, Illinois” all set up now. The next step is to specify the “then that” portion of the arrangement. We leave the office and then what?

Step 4 in the process is identical to step 1. We need to choose a channel that corresponds to the outcome we want. In this case we want the trigger to send a text message so we search for “SMS”.

Select “Android SMS” if on Android and just “SMS” if you’re on iOS. Once you select it and hit next you’ll be prompted to input a phone number to receive a confirmation PIN. Be sure to enter in the number of the phone that will receive the notification and not your personal phone. This isn’t a security check for your IFTTT account, this is a security check to ensure that the SMS number in input wants to receive the alerts (i.e. your spouse’s phone).

Note: Presently you can only tie one phone number to your account for SMS use so if you wish to use SMS alerts for other purposes you should opt to send the notification via different means (e.g. email, a Twitter direct message, or such).

Step 5 is the step where you choose the specific action you want. In the case of the SMS alert, and many other IFTTT channels, there aren’t multiple choices. The only choice for the SMS channel is, you guessed it, to send an SMS. Select “Send me an SMS”.

The default text message is a little generic so we’re going to customize it a little bit.

Many of the recipe outputs have custom elements (like the “OccurredAt” seen above). If you hover over the creation box and click on the resulting bell icon you can select related elements for your alert.

Confirm the recipe and it’ll be automatically added to your IFTTT recipe list (available both on your phone and on the web-portal).

That’s all there is to it! Once you jump through the minor hassle of installing the application and giving it access to your location data the world is your recipe-programming oyster; you can link your location to alerts, smartphone triggers, emails, pop-up reminders, and any other “then” channel available in the IFTTT system. Browse through the location-based Android and iOS recipes for more ideas.

Jason Fitzpatrick is a warranty-voiding DIYer who spends his days cracking opening cases and wrestling with code so you don't have to. If it can be modded, optimized, repurposed, or torn apart for fun he's interested (and probably already at the workbench taking it apart). You can follow him on if you'd like.