Browse By

How to create a Twitter bot

  1. Determine what your bot will do. Capabilities include the ability to push information publicly to everyone (i.e. a sports team bot might push the current score of a game after each new point scored; or a world news bot might push headlines with a link to world news items). Another ability is for a user to direct message your bot — essentially sending it a command (i.e. a user could send their zipcode to a weather bot and the bot could send a private direct message back to only that user with the weather for that zipcode; or a stock quote bot could receive a stock symbol from a user and send them back a direct message with the price of that specific stock).
  2. Register a Twitter username.
  3. Create the functionality for your bot on a web server. Push (public broadcast of info to anyone that is your bot’s friend) and/or Pull (user provides command, you send them a result) functionality.
  4. Use Twitter’s API to understand: retrieving direct messages and sending messages.
  5. Users can only send your bot a direct message if your bot adds that user as a friend. Thus, your bot needs to call the ‘befriend_all’ link, which will befriend anyone that has added your bot as their friend. Hit this link every 30(?) seconds:
    • An alternative option is to go into the settings of your Twitter username, choose to be alerted by email when someone adds you as a friend, and then monitor those incoming emails and add each user individually that way (automated).
    • Adding a username as your bot’s friend is easy, simply use the update function of the Status Methods.
  6. For push bots (broadcasting a single message to all users that are your friend or following you or viewing your webpage publicly), simply use the update function of the Status Methods.
  7. For pull bots (a user is your friend, you are their friend, they send you a direct message with some sort of command in it, you process that command on your server, you send them a direct message back with a result/answer to their query), use the direct_messages function of the Direct Message Methods to get the direct messages (“commands”) that users have sent to your bot. Then use the new function of the Direct Message Methods to send that user a direct message (“result/answer”) back to their query (note: direct messages are private, so only that user will see this result).
  8. Let others know about your bot! Post it at
  • Grant Bowskill

    For automatically adding people as friends, the bot I’ve made checks the friends requests page ( and extracts all user ids and then visits the accept url ( I couldn’t get the befriend all page to work.

    If anybody wants to try it out, add findprice as a friend on twitter, then from your cell phone text: “d findprice playstation 3” and you will get back the price of a playstation 3 on Amazon UK. It can take up too 2 minutes to get this reply.

  • Wambui

    Did anyone create an actual working Twitter bot for sending out follow requests? If so, email me. I’m interested

  • Den

    Twitter 411 – your own information system on the top of Twitter. Yes, it is a bot (with user defined responses). See

  • SEO Marketing

    still confusing, I just modifying some feed from mybloglog, and make new twitter account that acts like a bot. it automatically twits my recent update….

    btw what is the benefit for this messanging bot?

  • Den

    >btw what is the benefit for this messanging bot?
    twitting updates is like broadcasting. And message bots works by requests

  • Pingback: Is This The World’s First Useful Twitterbot?()

  • Larry M

    Here is a a new bot.

    I find it useful.

  • Pingback: Linky Pimp Friday 13/02/09()

  • Pingback: Mobile Messaging 2.0 » Tweetfoxxy: ‘Hooking up’ using Twitter: a hosted discussion on mobile messaging, devices, and user practices and trends()

  • Nuno Rodrigues

    If you want to check a bot which provides the results of the main football (Soccer) competitions just check

  • Jonas Lejon

    Thanks! I’ve just made a Twitter bot. More info

  • Twitter Bot

    Excellent, I’m loving the Twitter bots for pushing sports scores. Thanks!

  • patrick

    they made it very easy to create a bot with their newest api

  • Pingback: 3arabawy BookMarx 09/27/2009 (p.m.) at 3arabawy()

  • kEpEx

    I made a twitterbot, to RT tweets with certain word, see more on


  • vishnupriya

    Is there ant twitter bot which @reply to twitter users and developed using twitter4j

  • vishnupriya

    Twitter bot developed using twitter4j which replies to user through @username

  • streetparade

    Hy everyone i coded a twitter-bot called twitter-boot
    This bot does a lot of things checkout its opensource

  • http://atuljains atul jain

    I want to publish cricket score per 30 minutes.
    How can i do the same.
    i have the rss feed which is updated every minutes.
    but i want 30 minutes update
    hekp me

  • Edward Hotchkiss

    I wrote an example of using the popular Abraham’s TwitterOAuth library. It’s all object oriented and extendable. Full instructions in detail with download on my site. Check it out.

  • Owen Thomas

    Soooooooo, how does one create a Twitter bot??????

  • Twitter Bot

    Yes the informations exposed here are very useful in creation of a twitter bot.Thanks

  • Ahmed H

    Nice one 😀 It helped me start out =)

  • Diego Canale

    Hello Steve! i have planned 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

    what you mean hit the link “” ? i mean is it simply get or something other than that?

  • Steve Poland

    this info is really old.

  • Anonymous

    ok thanks for replying. i asked in stackoverflow and now I have the idea on how to do it. Its totally changed and somewhat more complicated! :/

  • vilas magare

    I created this twitter bot .