
If you are a Twitter power user like me, you may have been dismayed at some of Twitter’s antics over the past year, particularly when it comes to locking down their API. Twitter’s API gives developers an easy way of accessing data– such as public tweets and mentions and using them in interesting and innovative ways. There is no doubt that the API and the developers that used it made Twitter what it is today. I won’t go into too much detail about the changes made to their API, as I’ve already written about it before in relation to the paid for social network, app.net.
Not everyone has the time or the skill to develop apps, but a lot of people wanted to find ways of connecting Twitter with other services. Services such as IFTTT (If This Then That) make such a thing not only possible, but ridiculously easy. I’ve posted frequently about IFTTT, and in particular on How to archive your Digital life. With IFTTT it used to be possible to do all the following:
- Archive your Tweets to a spreadsheet
- Update Facebook/LinkedIn/Google+ etc with your Tweets
- Update your calendar with a tweet
- Send a text message when a particular keyphase was used.
Unfortunately none of this is now possible, since IFTTT was forced to remove all Twitter Triggers from their service due to Twitter’s API lockdown. For more information on what happened, you can read this update from IFTTT.
Hurrah for RSS!

However, do not fear, it is still possible, with a bit of tweaking. The power comes from RSS feeds. An RSS feed is a special feed that you can subscribe to in a programme or app called a feed reader. Examples of apps that read RSS feeds include Google Reader, FeedDemon, SoundGecko and Flipboard.
For example, here are the RSS feeds for my Twitter account, iagdotme:
- My Tweets: https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=iagdotme
- My Mentions: http://search.twitter.com/search.atom?q=@iagdotme
- My Favorites: https://api.twitter.com/1/favorites.rss?screen_name=iagdotme
- Search: http://search.twitter.com/search.rss?q=Search%20Phrase
With the search feed, you’ll have to convert your key phrase into a URL friendly one. That means converting each space into a %20 and each hashtag (#) in to #23. Sorry if that sounds complicated, but hopefully it makes sense when you look at the URLs above.
RSS is Dead!
Unfortunately, despite RSS being a wonderful technology, you wouldn’t think so if you look at Facebook, Twitter and Google+. All three have done their best at burying RSS and sucking all the life out of it.
Although Twitter currently supports RSS, is not going to be supported from March 2013. According to Twitter, XML, Atom, and RSS “are infrequently used today”. I really do wonder what planet they are on!
So, we’re going to be stuck with a special feed format called JSON. Now, unless you are a web developer you’re probably not going to know what that is. JSON is very easy to play with from a web development point of view, but it’s unusable to most people.
Just in case you are curious, here are the same feeds I mentioned above, but for JSON:
- My Tweets: https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=iagdotme
- My Mentions: https://api.twitter.com/1.1/statuses/mentions.json?include_entities=true (only when logged in as authenticated user)
- My Favorites: https://api.twitter.com/1.1/favorites/list.json?count=2&screen_name=iagdotme (only when logged in as authenticated user)
- Search: https://api.twitter.com/1.1/search/tweets.json?q=Search%20Phrase (only when logged in as authenticated user)
One big problem with the above is that you can’t access the mentions feed unless you are logged in to Twitter as that user.
RSS is Alive, Hurrah!
So, one way of getting your Twitter IFTT recipes back up and running and making sure that they’ll work after March 2013 is to convert your JSON feeds to RSS. You can add the RSS for your tweets to IFTTT or add your favorites. Unfortunately it’s not possible to create a feed of your mentions using this method, as it would require some more complex authentication scripts– and that’s not really my thing.
I looked at a number of solutions, but there are surprisingly few examples of how to convert JSON to RSS. I looked at Yahoo Pipes, but since Twitter only allows a certain number of calls on its API from each IP address, I found that each attempt failed.
The best way is to run the script on your own web site. Since most websites have PHP enabled, I’ve written the code in PHP. All you need to do is to upload this script to your website after changing the details to your own, and then you can have your very own RSS feeds of your Tweets. Unfortunately this won’t work for mentions, but perhaps I (or someone else) could create a script for that using authentication.
To use this, change the username to your own, set the url to the path of the file and upload it to your hosting space. This url will be your RSS feed which you can use for IFTTT.
<?php
// Update the following with your details:
$twitter_username = "iagdotme";
$this_url = "http://mywebsite.com/tools/json2rss.php";
header('Content-type: application/atom+xml');
?>
<rss xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com" version="2.0">
<channel>
<title>Twitter</title>
<description>Twitter Updates</description>
<link>http://twitter.com/<?php echo $twitter_username;?></link>
<atom:link type="application/rss+xml" href="<?php echo $this_url;?>" rel="self"/>
<?php
$string = json_decode(file_get_contents("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=$twitter_username"),$assoc = TRUE);
foreach($string as $items)
{
?>
<item>
<title><?php echo $items['text'];?></title>
<description><?php echo $items['text'];?></description>
<pubDate><?php echo $items['created_at'];?></pubDate>
<guid>http://twitter.com/<?php echo $twitter_username;?>/statuses/<?php echo $items['id'];?></guid>
<link>http://twitter.com/<?php echo $twitter_username;?>/statuses/<?php echo $items['id'];?></link>
</item>
<?php
}
?>
</channel>
</rss>
I hope this is helpful to you, if you have any more thoughts– let me know in the comments below!

Pingback: Feeding from Twitter into Evernote again | finding the {inner} geek