There are two types of example services:
- The Hello World examples are very simple versions of an IFTTT service in a couple different programming languages, designed to explain how a service can work.
- The service templates are frameworks based on services in popular categories on IFTTT. These can be cloned into your organization to give you a head start, though they don't have any example code behind them.
Hello World examples
Let's get started by creating a "Hello World" service that runs on your local machine and communicates with IFTTT. These represent the simplest implementation of a service.
First, if you don't see a Hello World service in your account, simply click here to create one. Then spin up one of these options:
- Getting started with Ruby on Rails
- Getting started with Node.js using Glitch
In this tutorial, we’ll answer your questions and help get your service up and running on the IFTTT Platform quickly by creating a simple service. We'll verify that the service is working by using the IFTTT endpoint tests. If you'd prefer, feel free to skim over this section or dive right into the Service API Reference!
Getting started with Ruby on Rails
Hello World: Ruby on Rails using Docker
hello_world.rb via Docker
First, install Docker.
Then, run the following in your command line to deploy the Hello World Ruby on Rails application within a Docker container (replace XXXXXX with your service key):
docker run -e IFTTT_SERVICE_KEY='XXXXXX' -p 3000:3000 ifttt/hello-world-ruby
Surf to http://localhost:3000/ to see it running. You should see a "Hello, World!" message.
Now you're ready to expose your local server via ngrok.
Hello World: Ruby on Rails using your local Ruby and Rails
Check your Ruby version
In order to run the Rails app you'll need version 2.2.2 or greater of the Ruby programming language installed. You can see which version of Ruby you have installed by running:
If you run into any issues with your local version of Ruby, we recommend using Docker instead.
Then, copy the following to a file named
hello_world.rb in your home directory:
Add your service key to your Rails app
Your service key is a secret key that is shared between your app and IFTTT. You'll need to copy and paste this key into your Rails app so IFTTT can correctly identify your service.
Run the Rails app
You'll need to open your Terminal and install the bundler Ruby gem:
gem install bundler
And then you'll be able to run the application:
Now, you can view the Rails app running at http://0.0.0.0:3000/ in your browser. You should see a "Hello, World!" message. You'll need to keep your Terminal window open so the application keeps running.
Now you're ready to expose your local server via ngrok.
Expose your local server via ngrok
Now that the application is running on your local machine, you'll need a way to forward IFTTT's request to your local development environment. We recommend ngrok for this because it's easy to install and free for our simple use case.
Open a new Terminal window and follow the ngrok installation instructions. Once you have ngrok installed, you can expose the app running on your local machine to the internet. Just tell ngrok what port your web server is listening on. In this case, it should be port 3000:
ngrok http 3000
You'll see some output which will include "Forwarding" URLs for http and https. These are the URLs where your application is accessible on the internet.
We'll be using the secure https URL, which will look something like this: https://abc123.ngrok.io (where the "abc123" will be some other random identifier.)
Visit the forwarding URL in your browser and you should see that "Hello, World!" message again.
You can now skip to the Give IFTTT your API URL section below.
Getting started with Node.js
Hello World: Node.js using Glitch
Visit the Hello World app on Glitch and click the “Remix To Edit” button. That will clone it and you’ll get your own version that you can later tweak and build upon.
After remixing the project you’ll notice a few files in your new Hello World project. You’ll see
.env. Until you decide to expand your service, these are the barebones that are needed.
Now, before we run all the tests for your service, let’s add the service key into your API.
Add your service key to your app
Your service key is a secret key that is shared between your app and IFTTT. You’ll need to use this key in your Node API so IFTTT can correctly identify your service.
First, to get your key visit the API page for your service here and copy the service key.
Now inside of the .env file that you saw earlier, you’ll see a key called
IFTTT_KEY. Paste your service key in there. It should be formatted like the following:
Give IFTTT your API URL
If you used ngrok and already have a forwarding URL, you may skip to step 2. Otherwise, copy the URL by clicking the “Show” drop-down and then the "In A New Window" button.
Visit your new service’s API page here, and input that URL into the IFTTT API URL field.
Run the endpoint tests
Visit the endpoint tests here, and click the Begin Test button. You should see that all the endpoint tests pass. Now go take a look at your Terminal or Glitch console to see the requests/responses from the endpoint test. Learn more about the endpoint tests here.
Build your own service
Try experimenting by adding new actions and triggers until you get the hang of things. Afterwards you can re-run the endpoint tests to see what happens. Then, check out the service API documentation to start building your own service (or take a look at the service templates below)!
Sign up to view service templates.