If you’re a avid Twitter user it’s more than likely that you’ve been retweeted automatically before. It recently happened to me when I tweeted my excitement for the new Transformers movie.

In this guide we’re going to look at how you can make your own Retweet Pipe using Yahoo Pipes & TweetBots, there’ll also be a live link to the working Yahoo Pipe so you can clone it for yourself.

ReTweet Pipe

Choosing your Topic

Firstly we need to have a topic or keyword we’re planning to ReTweet. There’s been a load of buzz this week about the iPhone 3GS so in this example we’ll ReTweet everyone who’s bought one & ask them to vote for their favourite feature on this iPhone Twtpoll.

Since we’re ReTweeting based on twitter searches choosing the right keywords are crucial, here’s 3 searches that fit our purpose pretty closely:

The method that we’ll be using grabs the data from the RSS Feed of each Twitter search. When you search you’ll see the “Feed for this query” in the top right, grab the URL’s for all the searches you want.

iPhone Twitter RSS

Importing the Feeds into Yahoo Pipes

iPhone FeedOnce in Yahoo Pipes you’ll need to create a new pipe. Since we need to parse RSS Feeds drag across Sources > Fetch Feed from the left hand navigation.

If everything is working correctly you should see the feed output in the debugger window at the bottom of your screen.

Filtering the Feed

Now that we have a constant feed of the data we want there’s a bit of filtering that needs to be done ust to get things in the right format for Twitter & the ReTweets.

There’s a few things that I’ve filtered out from the feed initially:

  • Our own name – we don’t want to ReTweet something to ourselves by mistake
  • ReTweets – we don’t want to ReTweet other people’s ReTweet’s, otherwise we’ll get stuck in an endless loop
  • Anything with an @, just so we’re only retweeting updates not replies

iPhone Filter

To do this just grab the Operator > Filter pipe from the navigation & connect it to the Fetch Feed we created before. This will allow us to filter things out based on the properties of the feed.

In this Filter we’re blocking any authors that match our name, all ReTweets & also anything with an @. You can choose to match any of these Rules (i.e. if you need to match 2 or more) or all of them.

Once you’ve set this up you’ll see the output of this Filter in the Debugger window again.

Looping the Elements we want together

Since some of elements of the feed aren’t all in the same RSS Property we need to combine them. In this example we need to grab the name of the Twitter user that we want to ReTweet & combine it with our ReTweet Message.

iPhone Loop

This bit is slightly trickier, grab the Operators > Loop Pipe & attach it to our previous pipe. Next we need to grab the String > String Builder Pipe & drag it into the middle of the Loop Pipe. The String that we’re building contains the URL of the user we need to ReTweet & will add our message onto the end “Just bought an iPhone 3GS! What’s your favourite new feature? – http://twtpoll.com/1e22eo”

We need to send the results to item.title as that’s the part of the feed that gets picked in the RSS Feed syndication.

Finally we need to just clean up the name of the person that we’re ReTweeting. You’ll notice that debugger still shows the URL of the person so we’ll need to replace http://twitter.com/ with @ so that we reply to them & they see our poll.

To do this just drag in Operators > Regex Pipe & in the item.title replace http://twitter.com/ with @

Replace Twitter

In your debugger window you should now see a nicely formed Tweet that’s ready to be fed into TweetBots.

Using TweetBots to Automate your Tweets

Create an account at Tweetbots & create a new bot. You’ll need to grab the RSS feed of your pipe so click on My Pipes then the pipe you want to grab the RSS Feed for. There’s a “Get an RSS Feed” option, grab the URL from there & input it into Tweet Bots, make sure you also click the “Use Feed Title Only” option.

iPhone ReTweet Pipe

Once the bot is created you should start seeing the Tweets come through every 30mins or so.

Want to build a ReTweet Pipe yourself?

There’s potentially thousands of uses for this type of ReTweet Pipe & of course it can be modified or adapted. If you’ve managed to create something much better than this example post it in the comments & we’ll collate them into the post.