How to set up automatic retweeting using a Google Apps Script, Yahoo Pipes, and TwitterFeed

Update (June 2015): several people have pointed out in the comments that there seems to be a authorization problem somewhere in the Google Apps script. Unfortunately I don't have time to dig in and look for the issue. If you find the problem, please let me know so I can update this post!

When Twitter released their API v1.1 in September 2012, they removed the possibility to create RSS feeds from timelines, lists or search results, and thus rendered many retweeting services and manually set up workflows disfunctional. One can rant all about Twitter moving away from their roots of providing an open communication ecosystem and how those restrictions clearly serve the main purpose of getting people to to show them ads, but here are the steps you need to take to get your retweeting back on track.

It has become a bit more complicated but no rocket surgery, as you will see.

So I have a personal Twitter account (that I barely use), one for my company Kraut Computing (that mostly tweets out new blog posts) and I just added one for the main project I'm working on, ProductWidgets (which I intend to use for support and spamming/harrassing potential customers).

I would like to retweet my Kraut Computing tweets and ProductWidgets tweets with my personal account. After some googling, finding reading incomplete posts, messing around with Google Apps Script, testing and debugging, this is what worked for me:

First act: Google Apps Script

You need: a Google account since we will create a Google Apps Script that is stored in your Google Drive.

  1. Head over to, sign in with your Twitter account and create a new application. Call it "My funky retweeting app" and add some random numbers since the name must be unique. Fill in random nonsense as the description and a similarly random URL as the website, they don't matter and are not validated. As the callback URL, enter After creation, take note of your Consumer key and Consumer secret, those are the two values we will need to use the API.

  2. Next you need to create a copy of the Google Apps Script I use to generate a RSS feed. Click here to create a copy of that script in your own Google Drive account. (note: you will see comments from the original authors Amit Agarwal and Mitchell McKenna in the script. They indeed authored it, I just fixed a few small issues.)

  3. Add the Consumer key and Consumer secret (which you jotted down when you created your Twitter app) in lines 14 and 15 between the empty apostrophes.

  4. Click to "File" > "Manage Versions" and click "Save New Version", then "OK".

  5. Click on "Publish" > "Deploy as web app..." and choose "Anyone, even anonymous" under "Who has access to the app", then "Deploy".

  6. Click on "Run" > "start" and "Continue". A window will open to ask you to grant the application access to your Twitter account. Click "Accept".

  7. Once you have authorized the Google Apps Script to access your Twitter account, you can close Google Drive. You will get an email to your Gmail account with some links to sample RSS feeds. Attention: those links are still from the original author of the script and don't work anymore. Replace "labnol" in the links with your own Twitter handle and it should work.

This was the first act: you now can create a RSS feed from a Twitter timeline, favorites, a list, or a search. Next we need to grab that feed and filter out some unwanted items. Yahoo Pipes is the perfect candidate for that!

Second act: Yahoo Pipes

If you haven't heard about Yahoo Pipes, it's described as "[...] a powerful composition tool to aggregate, manipulate, and mashup content from around the web." It basically lets you take a feed, run certain actions on each item, and return the updated version of this feed.

In this case it is perfect for us since we want to update the items coming out of our Google Apps Script slightly, i.e., remove retweets and messages directed at another user, and add "RT @username" to the beginning of the remaining items to make them retweets.

The simplest way for you to do this for you is to use my published "pipe":

Simply paste the URL to your Google Apps script into the Feed URL field, click "Run pipe" and then "Get as RSS". The resulting URL is the input we need for the next act.

Which URL you need to paste in there, you ask? Simply look at the email you received after the last step of the previous act, and replace "labnol" with the Twitter handle you want to retweet.

Third act: TwitterFeed

Phew, almost there! We now have a nice feed of the tweets of a Twitter account (or a list, favorites etc.) that we would like to feed (no pun intended) into our own Twitter account. The perfect tool for that is TwitterFeed!

TwitterFeed is a completly free service that lets you post to a Twitter account from a RSS feed. Simply sign up (only takes a minute) and add a new feed from the URL you received in the last act. Then you need to authenticate your Twitter account and you should be good to go.

TwitterFeed will regularly check the feed for new items and post them on your Twitter account automatically.

That's all, folks! Happy retweeting!

Discuss this post on Hacker News

Ideas? Constructive criticism? Think I'm stupid? Let me know in the comments!