Home | Archive | Contact

How to make a Twitter bot with no coding

As usual, lazy-man post overview:

With this post you can learn to make a Twitter bot that will automatically retweet users talking about keywords that you specify. You can achieve this with (just about) no coding whatsoever.

Why would you want to do this? Lots of reasons I guess, ranging from spammy to fairly genuine. Normally giving somebody a ReTweet is enough to make them follow you and it keeps your profile active, so you can semi-automate accounts and use it as an aide for making connections. That or you can spam the sh*t out of Twitter, whatever takes your fancy really.

Here we go.

Step 1: Make your Twitter Bot account
Head over to Twitter.com and create a new account for your bot. Shouldn’t really need much help at this stage.. Try to pick a nice name and cute avatar. Or something.

Step 2: Find conversations you want to Retweet
Okay, we’ve got our Twitter account and we’re going to need to scan twitter for conversations to possibly retweet. To do this, we’re going to use Twitter Search. In this example, we’re going to search for “SEO Tips”, but to stop our bot Retweeting itself you want to add a negative keyword of your botname. So search for SEO Tips -botname, likely this:

Twitter Bot

So my bot is called “DigeratiTestBot”. Hit search now, muffin.

Step 3: Getting the feed
The next thing you need to do is get the feed results, which isn’t quite as simple as you’d think you see. Twitter being a bit of a prude doesn’t like bots and services like Feedburner or Pipes interacting with it, so you’re going to need to repurpose the feed or it’s game over for you.

After you’ve done your search you need to get the feed location (top right) so copy the URL of the “Feed for this query”

Twitter Bot

Store that in a safe place, we’ll need it in a second.

Step 4: Making the feed accessible
Okay, so there’s a teeny-tiny bit of code, but this is all, I promise! You’re going to need to republish the feed so it can be accessed later on, but don’t worry – it’s a piece of cake. All we’re going to do is screen scrape the whole feed results page onto our own server.

Make a file called “myfeed.php” and put this in it:

$url = "http://search.twitter.com/search.atom?q=seo+tips+-yourbotname";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
echo $curl_scraped_page;

The only bit you need to change is:

“$url = “http://search.twitter.com/search.atom?q=seo+tips+-yourbotname”;”

which needs to be replaced with whatever your Twitter RSS feed that we carefully saved and stored in a safe place earlier. If you’ve already lost that URL, please proceed back to Step 3 and consider yourself a fail.

So, having completed this and uploaded your myfeed.php to your domain, you can now access the real-time Twitter results feed by accessing http://www.yourdomain.com/myfeed.php.

Step 5: Yahoo Pipes!
Now comes the fun bit, we’re going to set up most of the mechanism for our bot in Yahoo Pipes. You’ll need a Yahoo account, so if you don’t have one, get one and login and click “Create a Pipe” at the top of the screen.

This will give you a blank canvas, so let’s MacGyver us up a god damn Twitter Bot!

Add “Fetch Feed” block from “Sources”
Then in the “URL” field, enter the URL of the feed we repurposed, http://www.yourdomain.com/myfeed.php.

Twitter Bot

Add “Filter” block from “Operators”
Leave the settings as “Block” and “all” then add the following rules:
item.title CONTAINS RT.*RT
item.title CONTAINS @
item.twitter:lang DOES NOT CONTAIN EN

(You click the little green + to add more rules). Once you’ve done that drag a line between the bottom of the “Feed Fetch” box and the top of the “Filter” box to connect them. Hey presto.

Twitter Bot

Add “Loop” block from “Operators”

Add a “String Builder” from “String” and drag in ONTO the “Loop” block you just added

In the String Builder block you just put inside the Loop block, add these 3 items:

Check the radio box of “assign results to” and change this to item.title

Great, now drag a connection between your Filter and Loop blocks. Should look like this now:

Twitter Bot

Add “Regex” block from “Operators”
Add these two rules:
item.title REPLACE http://twitter.com/ WITH RT @
item.title REPLACE 2009 WITH (space character)

Extra points for anyone who writes “(space character)” instead of using a space. Also don’t miss the trailing slash from twitter.com/

Drag a connection between Loop Block and Regex Block, then a connection between Regex and Pipe Output blocks.

Finished! Should look something like this:

Twitter Bot

All you need to do now is Save your pipe (name it whatever you like) and Run Pipe (at the top of the screen).

Once you run your pipe, you’ll get an output screen something like this:

Twitter Bot

What you need to do here is save the URL of your pipe’s RSS feed and keep it in a safe place. If you didn’t lose your RSS feed from Step 3, then I’d suggest keeping it in the same place as that.

Step 6: TwitterFeed
Almost there, comrades. All we need to do now is whack our feed into our TwitterBot account, which is made really easy with TwitterFeed.com. Get yourself over there and sign up for an account.

To set up your bot in TwitterFeed:

1) I suggest not using oauth, as it will make it easer to use multiple Twitter accounts. Click the “Having Oauth Problems?” link and enter the username and password for your TwitterBot account and hit test account details.

2) Name your feed whatever you like and then enter the URL of your Yahoo Pipes RSS that we carefully saved earlier, then hit “test feed”.

3) Important: Click “Advanced Settings” we need to change some stuff here:

Post Frequency: Every 30mins
Updates at a time: 5
Post Content: Title Only
Post Link: No (uncheck)

Then hit “Create Feed”

Twitter Bot

All done!

Have fun and please, don’t buy anything from those losers who are peddling $20 “automate this” Twitter scripts. If you really need to do it, just make it yourself or if you don’t know how leave a comment here and I’ll show you how.


Like this article? Then subscribe to the feed!

Related Posts:

Next Post:
Does Blackhat SEO still work? »

Previous Post:

« Geo-Targeted Image Based Cookie Stuffing

115 responses to “How to make a Twitter bot with no coding”

  • kcortez says:

    Fun, fun – I’d like to use this technique to mimic the fun random reply bots like @TheBotLebowski. I”m looking at the YQL module and thinking – if I could only access a table that I populate with my random phrases then I’d have something. Having trouble getting a grasp of what to do. Anyone using this?

    Comment by kcortez
    January 10th, 2011 @ 4:16 pm

  • Suraj says:

    please help me on input/edit my message RT from Pipe

    Comment by Suraj
    January 25th, 2011 @ 10:35 am

  • Twittering Bot says:

    This is the greatest effin’ set of instructions EVER! I am NOT hyperbolizing!

    Comment by Twittering Bot
    February 6th, 2011 @ 11:16 pm

  • Dan says:

    Great stuff, I’ve been wondering how to create twitter bots, I’ll have to give this a go!

    Comment by Dan
    February 15th, 2011 @ 2:20 pm

  • jenson says:

    how to put our link (maybe using shorten url like goo.gl or another one). I think it will be pretty. Please feel free to reply to my email. Thanks for great stuff.. I love the post.

    Comment by jenson
    March 31st, 2011 @ 7:27 pm

  • roberto says:

    just finished the pipe, just need to upload the php but i dont have a website :(

    Comment by roberto
    April 3rd, 2011 @ 7:18 pm

  • roberto says:

    if anyone could help me! plealse!!! heres the code just upload it to your page and send me the link http://robertoalonso.tumblr.com/ (on the second post)

    if you help me with this ill send you a shoutout on my twitter 10k+ followers (@RobertoAlonsoB) send me the link trow twitter or my mail [email protected]

    Comment by roberto
    April 3rd, 2011 @ 7:25 pm

  • roberto says:

    lol wtf big fail cause twitterfeed only lets you feed 5 twits/half hour

    Comment by roberto
    April 4th, 2011 @ 12:10 am

  • Jean says:

    Looks like my URL stopped working and I cannot get it to work again.
    The URL by it self works fine, but will not produce results in the php script. I can’t figure it out. The code is exactly like you have in your example and I have replaced the ULR with the atom twitter URL. http://search.twitter.com/search.atom?q=%23LOA+-social_msi+-http
    Any insight would be good…

    Comment by Jean
    April 18th, 2011 @ 3:06 am

  • Ben says:

    Everything worked fine first time around but it’s not been updating. In fact when I refresh the pipe rss feed it doesn’t show any new entries (even though twitter search for the same criteria shows plenty) – it’s as if the pipe feed is fixed at the time I first ran it.

    Comment by Ben
    April 20th, 2011 @ 10:41 am

  • Mark says:


    This must be new.. Just find a similar service – there’s loads out there..

    Comment by Mark
    May 11th, 2011 @ 12:39 pm

  • Kodama says:

    A great article. A little tricky finding the search feed in the new Twitter, but a well practiced method!

    Comment by Kodama
    June 17th, 2011 @ 6:12 am

  • Juan Quaglia says:

    Great post, thank you very much! I have a little doubt: what if I want to make a different action? I mean, if I want the bot to reply instead of make a retweet.

    Comment by Juan Quaglia
    July 11th, 2011 @ 8:20 pm

  • ugur says:

    If this thing really works, you are a hero man!

    Great stuff I will try instantly.

    Comment by ugur
    July 21st, 2011 @ 12:32 pm

  • Harris says:

    Hey, I’m not sure if this is because I’m not looking hard enough or what but I can’t find the RSS feed link on twitter searches. Apparently they use something called OAuth? Any suggestions?

    Comment by Harris
    July 31st, 2011 @ 7:19 am