TechnologyJuly 6, 2011by Matt Hopkins69How to auto tweet and create your own Twitter bot

UPDATE (2015): Please note that Yahoo has now closed down Pipes which is referenced in this article.  See the announcement here

UPDATE:  Please note that the functionality described in this blog post relises on Twitter API version 1.0 which has now been deprecated by Twitter.  This means that the functionality described may no longer work for you.

If you are building a business and are perhaps too busy to be manning TweetDeck 24×7, then augmenting your real social media activities with the help of a bot may be just what you need.  Or perhaps you want to build a new twitter account that curates and auto-tweets specialist content.  Either way, here’s how you can build your very own Twitter-bot.

I have tried a number of systems and techniques, but have found the following approach to be the most effective.  On the surface, it appears to be overly complex – mainly because it uses three different sites to achieve its aim.  But its not as complicated as it may appear.


Here’s the sites we use and why:

Feedburner –  If we use Yahoo Pipes directly with a Twitter search, it will access the Twitter servers too frequently which will result in errors and timeouts.  Feedburner only updates a feed either every 30 minutes or when notified with a ping.  This means that we can be kinder to Twitter’s servers and will have more consistent data.

Yahoo Pipes –   We use Yahoo Pipes to clean up the results we get back from Twitter.  We eliminate spammy tweets, remove replies and retweets, and reformat the results so that we can retweet more easily.

Twitterfeed –  We use Twitterfeed to actually post/tweet the “cleansed” Yahoo Pipes feed.  You will note that you can tweet results directly from Feedburner but I don’t like this as a solution for two reasons.  First because we can’t clean up the feed like we can in Pipes and second because you have to link a Twitter account to your Google account, which we may not want to do.


1. Finding the Source.

For the purpose of this example, let’s say that we wanted auto retweet any tweet that mentions the London Zoo.  So, we are going to search Twitter using their interface with the following query:

“london zoo” OR #londonzoo -source:twitterfeed -filter:retweets lang:en

This query is saying – give me the most recent tweets that mention “london zoo” or the hashtag “#londonzoo” but ignore any tweets published using twitterfeed (remove the other bots like we are creating) and ignore any retweets (we only want the original tweets) and only give me those in english.

At the top right of the twitter search site, there is a link that says “Feed for this query” – if you click on that, you will get the following link which is your search results as an RSS feed.


2. Creating the Twitter Account.

If you already have a Twitter account, then skip ahead – otherwise you will need to create a dedicated Twitter account for your new bot.  For this post, I created a new account called LondonZoobot (@LondonZoobot).


3. Setting up Feedburner.

Setting up the Feedburner feed is very simple.

1. Go to and create an account / login.

2. Copy and paste the URL for the Twitter search from the step earlier into the box where it says “Burn a feed right this instant” and press “Next”

3. Change the Feed Title to something more friendly – we’ll name ours “London Zoo Tweets” and press “Next” the press Skip for the next steps.  Your feed should have a url something like

That’s it for Feedburner..


4. Setting up Yahoo! Pipes.

Yahoo! Pipes does the bulk of our work and so this is the most complicated part.  We’re going to basically run our new Feedburner feed through a series of filters to re-shape it.  We’re going to eliminate potential spam tweets, remove any replies, and then add “RT @”+username to the front of the tweet so that we can easily retweet the information in the next step.  It looks scary, but as with all things – its easy when you know how.

1. Create a new pipe by clicking on “Create a pipe” on the menu.

2. Drag the “Fetch Feed” box from the left side panel onto the Pipes grid and enter the URL for your new Feedburner feed (e.g.  This box is going to load your source RSS feed so that we can “clean” it.

3. Expand the Operators menu on the left and drag the “Filter” box to the Pipes grid.  This box is going allow us to remove any tweets that we wouldn’t want to retweet – for example – anyone mentioning a RT (should be eliminated in our Twitter search – but just in case) and any other words such as bad language or spam signals.  Add a few lines in the filter box, so that it looks like this (be sure to select items that match “Any” instead of “All”):

You can add more of these as time goes by to make sure that you are retweeting better quality tweets by filtering out the garbage.

4. Drag another “Filter” box from the left hand side to the Pipes grid.  We are going to add another filter that blocks any replies so that we are only ever retweeting original messages (this is “belts and braces” really).   It should look like this (note the “Matches regex” operator):

5. Now we’re going to tell Pipes to loop through each item in the RSS feed and add the Twitter account (Author) to the front of each tweet.  This is so that we can mention them in the RT a bit later.  So – drag a “Loop” operator from the left hand side to the Pipes Grid.  Then expand the “Strings” section from the left menu and drag a “String Builder” object to the center of the “Loop” box.  We want three lines – so press the “+” icon a couple of times – then.. select “” in the first line, then a space (” “) in the second line, then “item.title” in the third line.  We are replacing the title field in the RSS feed with Author URI + ” ” + item.title.  It should look like this:

6. Almost there – this last step is simply going to add the “RT @” to all of the newly created titles.  The actual “” is a url – something like “ and so we are going to replace all “” we find with “RT @”.  To this, expand operators on the left side and drag a “RegEx” box to the Pipes grid.  Set it to look like this:

7. Now join up all the pipes by dragging from the circle at the bottom of the first box to the circle at the top of the next box and so on.  It should now look like this:

8. Save your Pipe (press Save at the top) – and name it something useful – “LondonZoobot”

9. Final step – run the pipe (select “Run Pipe”) and then get the link for the RSS feed for this process by selecting “Get as RSS”. Should be something like –


5. Setting up Twitterfeed.

We use Twitterfeed to get the set of “clean” tweets from Yahoo! Pipes and then post 1-5 of them, every 30 minutes automatically.

If you don’t have a Twitterfeed account, create one.. they’re free, then login.

1. Select “Create New Feed”

2. Give your feed a name.. “LondonZoobot” and then copy and paste the RSS url from Yahoo! Pipes (e.g.

3. Select “Advanced Settings” so that we can tweak the feed just a bit more

4. Change the update frequency and number of tweets – I would suggest you leave the defaults as 30 minutes and 1 tweet at a time (otherwise it becomes too spammy).

5. Change PostContent to “Title only”

6. Click on “Continue to Step 2”

7. Now we are going to tell Twitterfeed which Twitter account you want to tweet to.  So – before you go any further, make sure that you are logged into the Twitter account that you want to use (on another browser tab)

8. Select Twitter.

9. Select “Authenticate Twitter” – and then “Authorize App” when you go to the Twitter site.

10. Click on “Create Service”

11. Click on “All Done”

That’s it!   Check out the auto tweets we just created here:!/LondonZoobot

You now know how to auto tweet by creating your very own twitter bot.  There’s a lot of steps in this I realize, but give it a shot – its not that difficult when you get stuck in.


  • Marnelle Apat

    August 24, 2011 at 11:01 am

    Hey Matt,

    thanks for sharing this brilliant idea. I just wanna ask for some clarifications. This means that by doing the auto-tweet, i need two twitter accounts? Am i right? One for the bots and one is your main twitter account.


  • Anonymous

    August 25, 2011 at 1:29 pm

    Not necessarily.  You can use this autotweet approach in your main account – to keep a consistent level of activity and then augment this with real user engagement (highly recommended)

  • Pingback: How to Generate a Twitter Bot

  • Diego

    October 12, 2011 at 7:47 pm

    Hello Matt,

    i wish to develop an AIML chatterbot as dialogue system to be embedded on twitter for my final year project for college. The user enquires on fligts and hotel rates by means of dialogue and the system should return with that information gathered from the internet by means of dialogue, tweets and messages suing the twitter account system. I definitely need to create a twitterbot, right?

  • Anonymous

    October 13, 2011 at 7:04 am

    Not sure if a twitterbot is what you would need.  Seems like this would require a program that monitors a twitter account and responds to requests.  It then searches other sites/APIs (flights, hotels) and responds.  You just need to have your software access Twitter via their API.  Good luck – sounds like a cool project.

  • Shailesh Tripathi

    October 18, 2011 at 2:17 pm

    Your article on Twitter  yahoo pipe is very interesting and appealing to readers. Thanks and wish to post you more article about it.

  • Hondon Villa Rentals

    October 25, 2011 at 7:52 am

    WOW! – I never knew about Yahoo Pipes ! – What an awesome tool – up there with the best of them. I can think of so many uses for this already.

  • Zombie

    October 28, 2011 at 4:04 pm

    Thank you for a great article, i want to add a constraint “stop @myusername” and the pipe never tweets that user again, is that possible? is it also possible to set it to never tweet any user twice?

    Second question, what if i don’t want it to RT the user but tweet the user a specific message e.g. @username predefined message – what pipe do i use for this?

  • Dick Foster

    October 29, 2011 at 2:38 pm

    I can’t find the “Feed for this Query” link on Twitter query page. Has it been removed or just moved to a new location.

    Great information. Thanks!

  • Anonymous

    October 30, 2011 at 7:46 am

    Interesting. They may have.  Here’s how you can still get it though.

    1. Look at the URL for the Twitter search.  
    2. Copy everything *after* the /search/ part of the URL – this is your actual search query.
    3. Append what you have copied to the following URL:

    4. Save the newly formed / combined URL as your search.  Should look something like:

    Hope this helps – and thanks for pointing this out for me.

  • WTreF

    November 14, 2011 at 2:31 pm

    This is great Matt!

    I have a question.  What if I want to add my own hash to each of these retweets before I RT it?

    For example – I own @WTreF and I repost folks who complain about refs.  So when I RT I would like to introduce my #WTreF to get folks familiar with it@WTre:disqus 

    If I RT someone saying WTF Refs or something similiar, I want to end it with #WTreF 

  • WTreF

    November 14, 2011 at 3:45 pm

    I figured out how to do this.  On Twitter feed their is an option to add a “Post” at the end of the tweet.  I put in #WTreF and it works great.  Now I have another issue.

    My tweets have the persons names and are TOO lengthy and cutting on the content.  For example here is a post it just retweeted on my @WTreF account @ 9:41am this morning (central time)
    ArronMacDonal (Arron MacDonald)RT @ArronMacDonaldIs still seething over last night’s game. Point wrongfully kicked out in 2Q,… #WTreF

    I would like it to look like this:

    RT @ArronMacDonaldIs still seething over last night’s game. Point wrongfully kicked out in 2Q,… #WTreF

    But where the “…” is finish up as much as possible, or if it’s too long, not even repost those…is that an option?  basically, removing the full name twice and blocking posts that can’t be repost without losing the message.

  • WTreF

    November 14, 2011 at 3:49 pm

    I would like to add a space in between the name and the first word as well.  The example above shows
    @ArronMacDonaldIs and it should be “@ArronMacDonald Is” – there is a space but my retweets are not posting them.

  • Anonymous

    November 20, 2011 at 6:35 pm

    Hi WTreF – sorry for the reply in responding.. been a busy period at work recently.  I am glad you have found how to add the hash tags in TwitterFeed.  

    To do the trimming that you would like to – I would recommend that you do this in Yahoo Pipes.  There is an option under “String” called Sub String, and you can select from a starting point.. up to a maximum number of characters.

    If you want to make sure that you always have enough room for #WTreF (6 chars) then you should set this as starting from 0 and up to 133 chars.

    Hope this helps

  • WTreF

    November 27, 2011 at 9:08 pm


    I got all you suggested to work.  I have one more idea I am not sure if it is possible.

    I want to be able to Retweet anyone that uses my name with a Hashtag.  (i.e. #WTreF)  The key is, I don’t want it to RT as myself, and include there name and put it as a RT in front of it (like you disucssed in the instructions).

    I want it to RT as I would if I were using my iphone app and hit “Retweet”.  NOT “Quote Tweet”.  It would appear in my feed as the original user posted it on my feed; however at the bottom it says “by WTreF”.

    Is this possible and how do you suggest it?  TIA

  • Anonymous

    November 29, 2011 at 8:06 am

    I’m not sure how to post these as “new” retweet formats.  Sorry.  

    If I find out, I’ll let you know.

  • Dennis

    December 9, 2011 at 8:07 am

    And when i continue set-up the twitterfeed, it is appears like this :

    1 error prohibited this feed from being savedThere were problems with the following fields:Feedurl A feed needs to contain publish dates or GUIDs in order to work with twitterfeed, see

  • Globe_city Citizen

    February 20, 2012 at 11:28 am

    On twitter research I can’t find how to export a search to rss feed

  • Rob Gordon

    March 11, 2012 at 3:32 pm

    Hi Matt, thanks for this great tutorial.
    I was trying to create something a bit different: a twitter account that replies with a random tweet (from a list of N pre-written tweets) to anyone who mentions a specific word or hashtag. As the Zoolander bot.

    Dou you know a way to achieve this? Is there any tool or tutorial you could recommend?

    Thanks in advance!

  • Kevin Blaak

    June 5, 2012 at 1:53 pm

    Is there any way to set it up like this, but for the bot the send an automatic reply to people mentioning the searched words ?
    So the bot would reply to people mentioning #LondonZoo in your case

  • 1MattHopkins

    June 5, 2012 at 5:00 pm

    Of course – just remove the RT in step 6.. just add the “@”

  • liquidmocean

    June 28, 2012 at 11:00 am

    Hey Matt,
    Great info BUT I got all the way to Twitterfeed and it came up with an error stating:

    “Feedurl A feed needs to contain publish dates or GUIDs in order to work
    with twitterfeed, see

    All steps were carried out to the T following your outline, I got the RSS URL but Twitterfeed won’t accept it?

    Any ideas?

  • liquidmocean

    June 28, 2012 at 11:41 am

    “At the top right of the twitter search site, there is a link that says
    “Feed for this query” – if you click on that, you will get the following
    link which is your search results as an RSS feed”

    I’ve been staring at the screen for an hour or so and nowhere can I see a “Feed for this Query” link! Can you upload a screen grab?

  • 1MattHopkins

    June 29, 2012 at 1:07 pm

    Are you hooking up the Yahoo Pipe to Twitterfeed?  I think I used to get that message if I connected the twitter search or feedburner (one of the two)

  • Chernenko Margera

    July 10, 2012 at 4:41 am

    it works but i got some problem, the bots responding

    Tuhan Memberkati RT @fragmangelTuhan fragma mohon jagai mama dan bapa hingga tiba di surabaya,amien

    we can see that @fragmangelTuhan actually, its @fragmangel account said  Tuhan fragma mohon jagai mama dan bapa hingga tiba di surabaya,amien

    how do i resolve this ?

  • 1MattHopkins

    July 10, 2012 at 8:03 am

    You need to add a blank line with a ” ” (space) in it – like in step 5 above.

  • coolppl

    July 11, 2012 at 6:39 am

    Thanks so much for the time you took to make this awesome tutorial! Worked for me!

    I’m so excited and now I have a further question that maybe you can help with. In yahoo pipes (or somewhere) I want to be able to filter out any phrase that separates my “london zoo” twitter search query with periods or other punctuation. 

    In other words, remove tweets that say I “I love london! Zoo is the name of the coolest club there”

    Any ideas?

  • 1MattHopkins

    July 16, 2012 at 7:58 am

    Absolutely – you just need to use a RegEx pipe.. and then use a regular express to either ignore punctuation – or in your example above, take the search string exactly as is -> here’s a reference:  

  • Ganna Boiko

    July 17, 2012 at 6:55 am

    Hi Matt, 
    It seems you spent a lot of time to write this post))) Great job! 
    If you are still interested in automatic retweeting – I’d like to tell you about up-to-date free service I use – RoundTeam. It retweets everything with defined #hashtags, @mentions or just key words. You can also choose from whom to retweet – from followers, form whom you are following or from all twitter.
    It took me about 2 mins to set up retweet parameters. 
    Hope it will work for you.


  • Tim

    July 29, 2012 at 1:06 am


    Here is an example of a tweet that was auto retweeted thanks to your methods.

    DatingSitesRevU (Dating Pro..)RT @DatingSitesRevU The Right Way To Learn Game Podcast Review… However, I would like to omit the name at the beginning “DatingSitesRevU (Dating Pro..) and just start with “RT @DatingSitesRevU:disqus Someone posted a similar question, but I am having difficulties figuring this out. How can I fix this?

  • Dools

    August 10, 2012 at 7:44 am

    I know this was made a long time ago, but how would i make it so, the bot does not retweet but simply replies to a word in a search query? Like the infamous Stealth Mountain. It would be insane if you answerd this 🙂

  • 1MattHopkins

    August 10, 2012 at 7:58 am

    Sure it works fine even today – take a look at @LondonZooBot on Twitter – it was set up using these instructions exactly. Make sure you follow step 5 (adding the space especially) and step 6 (adding the RT) above.

  • UCit Promo

    September 7, 2012 at 7:28 pm

    had a question regarding auto tweets Im a club promoter in Atlanta and I want to send my event info to anyone tweeting the words “Atlanta tonight”

  • Jeffrey Arnold

    October 22, 2012 at 7:38 pm


    Great post. I am working with a similar setup on my own, but even though I have “RT” at the beginning, the messages only show up as ‘mentions’ when I look at them in Hootsuite. Does this method actually get recognized in Hootsuite (and more importantly, Klout), as a RT, or is it just a ‘mention’ with RT at the beginning?

  • 1MattHopkins

    October 23, 2012 at 6:50 am

    They are just mentions – the same using a “via” or preceding the tweet with any character (“.” works too). The benefit really over true RT’s is that mentions go to all your followers..

    Thanks for reading and commenting.

  • Jeton R.

    October 25, 2012 at 12:34 am

    Hi there,
    Just a few changes to the pipe thing, bcz twitter has changed their rss. Need to add regex before loop with this rule : in replace* with leave empty and then in loop string builder 1st row: RT @ 2nd row: 3rd row: 1 space 4th row item.description. Check the image I upload!

  • francisco

    November 7, 2012 at 12:05 am

    Matt great work! I was wondering if there is a way to autoretweet the exact twit received instantly (or in less than 5 min)

  • Uittip

    November 8, 2012 at 2:04 pm

    My string builder doesn’t add the RT @ ? Any idea why not?

  • Alejandro

    November 16, 2012 at 11:28 pm

    Hi! Im currently using this very same technique to find a keyword and replying the user who tweeted. However im not able to tweet the reply as a reply of the user tweet, its like a separate tweet with no link with the original.

    I would like it to be as if I hit the “reply” button on the original tweet, so when they click on the tweeted reply, it shows the original tweet.

    Any idea how through this method?


  • d7ibril

    January 18, 2013 at 5:58 pm

    Hi Matt,

    I tried to follow all your instructions but I couldn’t find ‘RT @’ on my retweet..looks like those are my original tweet..please help..thx

  • 1MattHopkins

    January 18, 2013 at 6:23 pm

    Did you get anything at all?

  • d7ibril

    January 19, 2013 at 2:17 am

    Yes I did, I’ll try to start all over again to see if something missed and get back to you soon..thx for your reply..

  • d7ibril

    January 19, 2013 at 3:25 am

    Hi Matt,

    I made a mistake with the’s working now..great tutorials..! btw is it possible to exclude a twitter username which is a similar twitter account that I don’t want to retweet? Please help..thx

  • Wayne P

    January 22, 2013 at 9:15 pm

    Unfortunately this method no longer works – Twitter doesn’t parse “RT @” to post on you’re behalf, it’s just you reposting the exact text. If I go onto Twitter and manually click “Retweet”, the message I post says “@username retweed:” above the message. The message has a picture of the user I retweeted and the content is what they posted. By using the method posted (and a number of variations of it that use the Twitter API as the source), it’s as if I just write a message mentioning them. I am guessing it has to do with Twitterfeed in between but maybe there’s a way with pipes to post to the Twitter API?

  • 1MattHopkins

    January 22, 2013 at 9:35 pm

    This method does still work – but you are correct that they are no longer considered “retweets”.. but they are now considered “mentions”. You could replace the “RT @” with anything before the “@” with the same effect – e.g. “.@” — but the approach is still valid today.

  • bigajm

    February 10, 2013 at 5:22 pm

    I’ve been using this system of Twitter search results via RSS >> a Yahoo Pipe >> >> Twitter to retweet certain keywords successfully for over a year. However, I’ve recently read that Twitter is ending support for search results via RSS in March 2013.

    Is there any other method of acquiring a stream of Twitter search results and feeding them into Yahoo Pipes?

  • Customer Service

    February 23, 2013 at 5:42 pm

    Check that your twitter url in Regex ends with a /.

  • Customer Service

    February 23, 2013 at 8:31 pm

    No matter what I do, the RT @username does not appear in the tweet. All else is working perfectly. I have stared at this for hours and do not see what the problem is. Anyone else have this issue?

  • 1MattHopkins

    February 24, 2013 at 11:56 am

    Can you send me a screen shot of your Yahoo Pipe? Perhaps I can see if there is anything missing. Or – here’s a screen grab of the whole pipe I use for the “London Zoo” example above if that helps.

  • Customer Service

    February 24, 2013 at 3:30 pm

    On the loop entry, what do you actually do to get the space. Do you actually type in a space using the space bar or do you type in ” “? Also on Regex, I have a space between RT and @ sign. On the filter does it end with “.”? thanks so much as this is driving me crazy and I am determined to figure out what I am doing incorrectly.

  • 1MattHopkins

    February 24, 2013 at 3:38 pm

    On the loop entry – you need that 2nd line and it has a space – a ” ” in it. There is also a space on the Regex section (between the RT and @) and the filter is “@.” (with the period at the end). Hope this helps.

  • Customer Service

    February 24, 2013 at 3:49 pm

    I put a note on the string and it will not let me leave it blank or type in a space. What do you actually type in on the keyboard for that center string? thanks for the help.

  • Customer Service

    February 24, 2013 at 3:53 pm

    Also, I am blocking some Twitter accounts that I do not wish to mention. That would not impact it, but in the field of Block – I just have the twitter account name only. So if the account were, I only have twitterapi in that field for the account I wished to block. Is that correct?

  • Customer Service

    February 24, 2013 at 3:54 pm

    Yes, it all helps, except the space issue. It will not let me save the pipe with a space in that field. I guess I am not entering the exact string for space correctly. All other items you pointed out are correct.

  • 1MattHopkins

    February 24, 2013 at 4:38 pm

    Mine doesn’t have “for each *item*” – try with a blank string builder

  • Customer Service

    February 24, 2013 at 4:55 pm

    What I do notice is that you cannot edit the string once you do it. I had to delete the entire loop and add it back in and start over with string again. I have simply skipped that center box completely and left it blank so I am testing it now. Blank meaning, nothing was entered at all. When I refresh in the bottom of the preview screen should I see the RT @name in front of that preview too?

  • Customer Service

    February 24, 2013 at 5:11 pm

    I wonder if they changed something and they are not permitting the space now. If you did this again, does it give you the space on a new pipe like this? Do not mess with your old pipe, because it is working, but if you did a new pipe?

  • Customer Service

    February 24, 2013 at 5:27 pm

    It seems to take the RT from the string builder center box ,but is ignoring the Regex box completely. It seems it just ignores regex completely for me.

  • Steven Talbott

    March 24, 2013 at 11:09 pm

    Did you ever figure this out? Having the name in “()” takes up too much room. How do you eliminate?

  • Eco Log

    May 28, 2013 at 8:39 pm

    I guess this post is quite old now. I see your zoo bot is still tweeting well. I’m trying to do this now, but it seems that yahoo pipes have chaged the way twitter authors are published.

    Everything works perfectly, but I don’t get “” as an option for author. All I get is “”, which posts differently from what you describe. What am I doing wrong?

  • 1MattHopkins

    May 29, 2013 at 6:07 am

    Are you using Feedburner for your RSS feed? Pipes just provides the fields that it has been given – check to make sure that you are pulling your Twitter search feed via Feedburner.

    This whole approach has a limited lifespan anyway considering the changes that Twitter will be making soon (deprecating their REST feed model). And won’t work for much longer – for any of us.

  • MJN

    June 23, 2013 at 6:11 pm

    When I search on twitter I cannot get the RSS get feed button (I think Twitter have changed things) can this still be done?

  • 1MattHopkins

    June 24, 2013 at 6:12 am

    They have changed it and are dropping / have dropped the functionality for the whole approach mentioned in this blog post which means that you can no longer get twitter searches using RSS.

  • Naukhaiz

    February 18, 2014 at 12:59 am

    Undoubtedly the most helpful blog on the internet. Kudos!

  • Tyrion, O Meio Homem

    April 4, 2014 at 1:40 am

    I made this configuration today and my tweet was duplicated. I mean, was like: “RT @user User @user tweet….” – why? 🙁

  • Houses In Spain

    August 17, 2015 at 4:31 pm

    Lovely article, thanks to share it with us

Comments are closed.