IFTTT is a tool for connecting plethora of different cloud and mobile services. In this post, I go through how I use IFTTT to share my posts in social media.
The problem to be solved
Every time I write a new blog post, I want Facebook, Twitter and Tumblr have a link to it. I also want a shortened link.
Since I have built my own blogging system from scratch, I need to handle all social media integration myself. Rather than calling the APIs of those services my self, I let IFTTT to do the heavy lifting.
If you have built your blog from scratch, you use static site generators (such as Jekyll) or your blogging platform does not support some particular social media service, similar approach might be useful for you too.
However, if you'd like to use this approach, there are some prerequisites; You must have a feed (RSS or Atom), an IFTTT account (free) and a accounts in all the social media services you use.
- feed (atom or rss)
- IFTTT account
- Accounts for Facebook, Twitter Tumblr etc.
The solution and some background
Once you meet the prerequisites the actual work you need to do boils down to to steps: You need to select “if new feed item” trigger from Feed-channel and select an appropriate action from a social media channel. Below I’ll explain the steps in more detail and give some background.
IFTTT’s name comes from a basic programming paradigm, “if this then that”. Meaning, if a certain condition matches, such as an image appears to your camera roll, then do something to that image. This is also how IFTTT approaches the problem to be solved.
In IFTTT, a recipe is the complete description what will happen if a condition is met. A recipe has two parts, a trigger and an action. The trigger is the “this” in IFTTT, and the action is the “that” part of the paradigm. Triggers and actions are grouped into channels. Each channel has a limited set of triggers they can react to and actions they may perform.
The channel I use to communicate with IFTTT is the Feed-channel. I publish an Atom-feed of the latest posts in my blog. You could also use RSS, but I chose Atom, since it has some nice extra features. There isn't much difference what you choose, as long as you have a feed of your own. It's ok if you don't know whether your feed is Atom or RSS, the Feed-channel can automatically handle either.
Feed-channel has “if new feed item” -trigger that polls my feed from time to time (roughly every hour). For instance, if a new blog post is added to a feed, then it will publish a link to the post in Twitter.
The “if new feed item” -trigger has some requirements. Whether you use Atom or RSS your feed needs to have x, y an z elements. If you use Wordpress, you meet these requirements already. However, if you some other platform you should check that your feed have these elements.
Let's use Twitter as an example again. To get a link published in Twitter, you need to add an action to your recipe. In the case of Twitter, I use the Twitter-channel's "post a tweet" -action. After this you are done…unless you would like to publish to another service too.
Note, you can customize what you post. Both triggers and actions have ingredient fields, e.g. title, url and so on.
Publishing to another social media service follows the same steps. Unfortunately there isn't a way to use a single trigger for all of the publish actions, so you need to repeat the same steps for each service.
The Good and the Bad
If you have gotten what you wanted out of this post, run away. Now. What follows is a longish ramble about the good and bad of this approach and IFTTT in general. Tl;dr; it's mostly good.
First, I’m not here to advertise IFTTT. I like the service a lot and I hope it sticks around. But I’m not getting anything from them.
The main reason I use IFTTT is because its just so easy. I could do the API calls to Twitter, Facebook, Tumblr etc. myself, but I'd rather do other things with my time. For IFTTT, I only need to generate a feed that they can access.
The service itself is easy to use and access. I can create or edit a recipe from my Mac or from my phone. So if there are issues with a script, I can edit it on the go.
Oh, and the service is free (at least for now). You really can't beat free. This is a big thing for me. What they offer is of value to me, but I could do the same myself without them. The service being free, the choice was easy.
There are some downsides too. IFTTT is a low barrier cloud service, so things must be made simple and easy. Simple doesn't necessarily mean limited, but you can see clearly they did not design the service just for programmers.
IFTTT has a limited set of channels (most of the big, obvious ones and plenty of more obscure channels) and those channels offer only limited set of triggers and actions. However, the biggest limitation is how you combine the triggers and actions. Like I mentioned earlier, you cannot create a trigger that is used more than one action.
If you completely rely on IFTTT then you have a dependency and that might give you issues in future if IFTTT starts to collect fees or goes away. IFTTT is an information broker, not an information collector, so at least you don’t loose data if things change.
So far, limitations or dependency on the service has not affected me. I wish they had a Bitbucket channel, but even that would be just nice to have. Not really crucial for my blog.
The Feed-channel uses polling. They periodically check my feed for new items. It seems they are smart enough, not to poll separately for each recipe.
Polling is not an efficient approach. Sadly, in the case of feeds, it's the only available approach. So I'm happy to see they try to make polling smarter at least.
From my logs I can see that they check my feed about once every hour, despite claiming that they check trigger events every 15 minutes or some cases more often.
This has negligible impact on my server, so it's not really consuming any vital resources. Still...polling is icky.
All in all, I see no reason not to use the service myself. It makes my life easier. It's a well done and has plenty of other applications besides feeding social media services.