Brandon Mathis, the creator and maintainer of Octopress, recently tweeted a method to programmatically create tweets from new Octopress blog posts. Moments after that, he retweeted a reponse from another Octopress user which outlined a simpler method using ifttt.com, a web site which lets you create automated actions based on conditions.
The site’s name is prounounced like “lift” but without the “l”, as it they proclaim on their homepage. The awkward construction comes from “if this then that”, which describes the web site’s purpose: if a thing happens, then do something.
There are a huge range of triggers you can pick from and actions you can accomplish; the site gives lots of ready-made examples (which they call “recipes”)—automatically send yourself a text message if you’re tagged in a photo on Facebook, or automatically take anything you send to Instagram and archive it on Dropbox, and lots of other things. I was interested in using it to automatically tweet anything I post on the Bigdinosaur blog. There are recipes already created for if you have a Blogger or Wordpress blog, but Octopress doesn’t have the external hooks those other blogging engines do (or really any hooks, since Octopress is just a flat-file blog!), but Octopress does automatically update its RSS feed whenever you make a new post. Since you can create actions based on RSS feeds, we’re all set!
You’ll need to create an account to use the site. Once you’re logged on, navigate to your dashboard and click “Create Task”, and you’ll be presented with the following:
Click the large “THIS” link to define the type of trigger—the “this” part of “if this then that”. You’ll get a list of things you can pick from to cause your task to trigger:
We want to use RSS events, so click “Feed”. Then, you set the conditions that apply to that trigger—that is, you tell the site what has to happen to the trigger to make it actually trigger. There are two options for RSS feeds: “New feed item”, where any new item in the feed will trigger the event, or “New feed item matches”, where only new items with specific keywords will trigger the event. We want the first one:
Then, we tell it the URL for the RSS feed we’ll be monitoring:
Now that we’ve picked our “this”, we get to pick our “that”—the thing we’re going to do:
We’ll get a list of action channels. Again, there are lots of potentially cool things we can do here, but we want to click the Twitter icon.
At around this point you’ll probably be told you need to “activate” the Twitter action channel, which simply means that you’ll need to authorize ifttt.com to interact with your Twitter account via Twitter’s web API. You provide your Twitter credentials (to Twitter, not to ifttt!) via a browser pop-up window, and then ifttt.com can post things to your Twitter account on your behalf.
Once this is done, choose “Post a new tweet” from the list of actions:
Next we get to format our tweet. There’s a drop-down list of variables that you can pick from to have ifttt automatically substitute in the name of the blog post, the blog post’s author, and other bloggy metadata. The format I’m using is shown in the image below:
Last, you’ll get a confirmation window showing you the completed action. You can also provide a brief description for the action so you know what it is when you see it sitting in your dashboard:
To test the task out, click the blue “Inspect task” button on your dashboard, and then click “Check now” to cause the task to fire. If you’ve done everything right, a new tweet will be created in your Twitter account from the last entry in your blog’s RSS feed.
Truly, we’re living in the future! :-)
Discussion topic for the original blog entry at: http://blog.bigdinosaur.org//if-this-then-that-dot-com