Maker guide

Introduction

Welcome to the IFTTT Platform! As a Maker, you can build powerful Applets and publish them for other people to use. Your Applets can also use multiple actions and custom code to go beyond the basic “if this, then that” paradigm.

Getting started

All Applets have a trigger and at least one action. Let’s build an Applet that uses a trigger from the RSS Feed service and actions from Feedly and the Notifications service.

Triggers

First, we need to choose the trigger, which is the signal for the Applet to run. In this example we’re using the RSS Feed service, which you can find in the “Search for services” field. Once you’ve picked the service, you can choose the “New feed item” trigger from the dropdown.

GIF showing how to add a trigger in the Applet creation tool

Then you can choose any RSS or Atom feed you want — for example, https://www.theverge.com/rss/index.xml.

Actions

Next, let’s add two actions to the Applet by scrolling down and clicking “Add action.” For the first one, we can use Feedly’s “Save an article for later” action.

Creation of a new action using the Feedly service

To add another one, repeat the process with the Notifications service’s “Send a notification from the IFTTT app” action.

Creation of a new action using the Notifications service

One important thing to notice about action fields is that each field is either hidden from or visible to a user who enables the applet. If the field is hidden, you can use ingredients to change its value depending on the trigger, just like when you create an Applet from scratch as a normal IFTTT user.

Filter

We could title, save, and publish this Applet now — it’s good to go. As is, it would save new RSS items to our Feedly and send us a notification. But we’re going to make it a little more interesting by adding some filter code, which is JavaScript code that you can write to customize the behavior of your Applet.

In this case, we’re going to write code that checks the time and then either sends a notification or saves the publication to Feedly. The code would look something like this:

var timeOfDay = Meta.currentUserTime.hour();

if (timeOfDay > 22 || timeOfDay < 8) {
  IfNotifications.sendNotification.skip("Too late; saving to Feedly");
} else {
  Feedly.createNewEntryFeedly.skip("Sending notification instead");
}

First we use Meta.currentUserTime to get the current time in the user’s timezone. Then we call hour() to get just the hour as an integer between 0 and 23. If the hour is above 22 (10 PM) or below 8 (8 AM), we want to skip the notification action and run the Feedly action; otherwise, we want to do the opposite.

Branding

Now all that’s left is the title, description, and branding for the Applet. The title and description help other people understand what your Applet is for and how it works. The “Applet service” field determines which of the services your Applet uses (in our case, RSS Feed, Notifications, or Feedly) should appear at the top of the Applet’s card and what color the card should be.

Title, description, and branding

Once you’ve filled these fields out, you’re ready to save the Applet and start using it!

Publishing

When you first create your Applet, it’s private, and only you can see or enable it. Once you’ve tried it out and you’re confident that it works well, you can share it with the world by clicking the “Publish” button on the Applet’s page.

The Applet page

Once you publish an Applet, it’ll be visible on your personal Maker profile and can also be discovered elsewhere on the site.

If you publish an Applet and then decide you don’t want other people to see it anymore, you can click the “Archive” button on the Applet’s page to make it invisible to everyone except you and anyone who enabled it while it was published.

Filter code

When you build an Applet as a Maker, you can use the filter code feature to add extra flexibility and power by writing your own JavaScript that runs whenever the applet does. Your code has access to the data returned by the trigger, as well as metadata like the current time in the user’s time zone, and it can use that information to override action field values or skip actions.

See the Templates page for some examples of what you can do with filter code.

The filter code API

There are some fields that are always available:

  • Meta.currentUserTime: The current time when your code is evaluated, in the user’s timezone. This returns a Moment.js object.

  • Meta.triggerTime: The time that the trigger event happened, in the user’s timezone. This should be close to currentUserTime, but could vary depending on the polling period of the Applet’s trigger. This returns a Moment.js object.

There are other parts of the API that depend on the specific trigger and actions that your Applet uses. For example, if your Applet uses the Weather Underground service’s “Sunrise” trigger, your code can use Weather.sunRises to get the trigger’s ingredients. If it uses the LIFX service’s “Toggle lights on/off” action, your code can use Lifx.toggle to override that action’s fields or skip it instead of running it.

The trigger’s object contains the values of each of the trigger’s ingredients. If you’re using the “Sunrise” trigger, you can get the current temperature in Celsius by writing Weather.sunRises.TempCelsius. For convenience, you can also just write Trigger.TempCelsius, since an Applet can only have one trigger. Note that the ingredient values are always strings, even when they represent numeric data.

Each action’s object has the following methods:

  • skip(): This lets you skip an action instead of running it. You can optionally provide a message that will be shown in the user’s event feed to explain why the Applet decided not to run the action.

  • set[FieldName](): For each hidden field of the action, you can use a correspondingly-named setter method to override its value. If you do, the value you provide will be used verbatim, skipping the templating step that normally happens with hidden fields. If you want to use ingredient values, you can do so by using string concatenation or JavaScript template literals:

   Twitter.postNewTweet.setTweet(
     "The sun rose at " + Weather.sunRises.SunriseAt
   )

Technical details

  • When you write filter code, you’re technically writing TypeScript, not JavaScript. This helps prevent runtime problems with your code by catching simple mistakes as early as possible. You should generally be able to just write normal JavaScript, but the TypeScript documentation may be helpful if you run into issues with more advanced use cases.

  • Filter code is run in an isolated environment with a short timeout. There are no methods available that do any I/O (blocking or otherwise), so your code should execute quickly.

Debugging

From time to time, it’s possible that you might accidentally write some filter code that has a bug in it. If this happens, you can use the Applet’s logs to help diagnose the problem.

First, click the “View logs” link to get to your Applet’s logs.

The Applet page with "View logs" link

If your Applet isn’t working, the logs should contain feed events describing the failures. By clicking “Show details,” you can see the ingredients from the failed run, as well as information about any exception your code might have thrown.

A log item with details

Glossary

Action

An action is a task that IFTTT can perform as a result of an Applet run — things like “Turn lights on,” “Update your profile avatar,” or “Create a text file.”

Each action belongs to either a third-party service like Feedly or Twitter or an IFTTT-specific service like Notifications. Most actions have action fields, which are parameters that determine what happens when the action runs and can be configured either by your Applet or by a user who enables it.

Applet

Applets are the basic building blocks of IFTTT. They allow users to automate interactions between different services they use. Applets can be turned on from IFTTT.com, from the IFTTT mobile apps, or from inside some third-party apps.

Ingredient

Each trigger has ingredients — individual pieces of data that come back from the trigger every time the Applet runs.

Here are some example ingredients from the Twitter service’s “New tweet by you” trigger:

  • Text – The tweet itself.
  • UserName – Your Twitter handle.
  • LinkToTweet – The URL of the tweet.
  • CreatedAt – The date and time the tweet was created.
  • TweetEmbedCode – The HTML embed code for the tweet.

Your Applet can take the individual ingredients provided by the trigger and use them to fill in action fields.

Trigger

A trigger is a source of events that IFTTT can respond to by running your Applet — things like “You are tagged in a photo,” “Check engine light turned on,” or “Tomorrow’s weather report.”

Each trigger belongs to either a third-party service like Feedly or Twitter or an IFTTT-specific service like Notifications. Most triggers have trigger fields, which are parameters that determine the circumstances when the trigger should go off and can be configured either by your Applet or by a user who enables it.