Anatomy Of A Twitter Bot

I’ve come up with two ideas for Twitter bots, Lyric of the Day (@lotd), and Shake Shack Flash Mob (@shakeshack). They both work the same way. People follow the twitter account (click on the links to do that) and then people post messages to the account with the @ sign.  Examples are:

@lotd "I’ve been walking Central Park singing after dark people think I’m crazy" Miss you, The Rolling Stones


@shakeshack andrew and I are going to the shake shack today. we’ll try to get there around noon. will twitter the line length then

both of these messages were sent today, one by me and one by this guy

when you post a message like one of the examples to the twitter account with the @ sign, it gets sent to everyone who is following the account

Whitney McNamara wrote some Perl code that does the one thing that Twitter doesn’t do for you – repost the message sent in to the account’s timeline.  He’s had a number of requests for that code in the couple weeks since he built it and he posted it on his blog this week.

I hope this means there will be more Twitter bots in the coming months. They are a great way to run a group on twitter.

#VC & Technology

Comments (Archived):

  1. Joe Lazarus

    Someone should make a service that creates and manages Twitter bots through a simple web site. I’m sort of surprised it doesn’t already exist… then again, maybe it does and I just don’t know about it. TwitterFeed is pretty close.

  2. joshua schachter

    This wouldn’t require code if the twitter “track” code let you track strings containing symbols (eg @lotd etc)

  3. charlie crystle

    It was cool to see the kid who was arrested in Egypt use Twitter to alert his friends–and his subsequent release. http://latimesblogs.latimes

  4. mccv

    I actually used code posted here… to add more real time support to one of our apps. The pros: it uses the Jabber interface so you can handle tweets realtime. The downside: as we found out this week, the stability of Twitter’s Jabber interface isn’t exactly the same as its HTTP interface… and unlike the Perl example, if your service or Twitter’s service is down you don’t get things queued up, they just poof.

  5. Srini Kumar

    This is just about the most intelligent comment on Twitter I have ever read. Someone out there really understands twitter in the VC community, I am happy and amazed. This is going to be a massive set of businesses – almost like an open-source listserv. I wonder if Twitter has some juicy account names set up in reserve for itself… it could be like a domain-name spree… and what company wouldn’t want this kind of access to its fans? (other than bad companies of course)You might like us too ( 🙂

  6. howardlindzon

    man do I see this is a boon for stock guys once again and for promoters to move penny stocks. think flash mobs to thinly traded stocks.

  7. whitneymcn

    Thanks for the link, Fred.Funny little coincidence: the LOTD lyric you picked is from one of the people working on a Twitter bot. Attila is going to do a movie quote version, I believe.@joelaz is the closest thing that I’ve seen to the sort of bot creation site you’re talking about — it’s the same idea as LOTD except that the communication happens through Twitter direct messages rather than @replies, so it’s private rather than public group communication. I expect that you’re right and more such services will be popping up before long.I also kind of expect to see Twitter building similar tools at some point, since the ~1,500 API calls/day limit means that third parties can’t do group tools that scale very well. Any large group or tool that uses direct messages will burn through those API calls pretty quick. Interesting possibility for Twitter, actually: people can build their own groups using the API, or pay a monthly and use Twitter-native group tools so that (a) no coding is required, and (b) the group can scale since you’re not API rate limited.

    1. mccv

      @whitneymcn – small clarification on the Twitter API calls/day limit. Post operations (which I assume means direct messages) don’t count against the limit. It’s entirely feasible to build largeish scale applications using just the HTTP interface, but they’re not going to be realtime. By the time you add autofollowing you’re probably down to a 5 minute refresh cycle.

      1. whitneymcn

        Excellent — I obviously haven’t spent enough time with the API docs. 🙂 Thanks, mccv.

  8. ali

    another interesting twitter news…

  9. Greg Cohn

    there are a bunch of ways to do this, but “retweet @username replies” would be such an easy option for twitter to integrate. as would “tweet #tagspace” or “tweet RSS feed”.

  10. RacerRick

    We made a ‘twitter bot’ for Milwaukee area food recommendations. It’s We’re going to make a few more, like nycfood, etc.Fyi, I tried to get the guy to build a service and he says he’s got no time because of his day job. This should be his day job!

  11. Prashant Sachdev

    twitter is great! simple and easy to use application make things a success.i like the applications people are creating around twitter. i would like to have twitter app as private tool to discuss the daily work inside company. email / forums / blog / wiki are not the perfect solution for this….but twitter like app would be let me know if you know of any such thing.

  12. jeckman

    I’ve written a similar app in PHP, though relying on the hashtag instead – #lotd or #shakeshack instead or @.This also means the items get picked up at and other places #hashtags are used.You can get it (called ReTweeter) at: http://www.openparenthesis….

  13. jackson

    “Waiting on this line at Shake Shack I’m reminded of the Saxon song ‘And the Band Played on’.””Just before dawn in the cold lightWe came out of the nightA great expectation from the man who ran the showWill it rain, will it snow, will it shine, we don’t knowAre there clouds up in the skySee the people, feel the powerThere was sixty thousand thereJust like thunder the crowds began to roarWhere you there, did ya know, did ya see all the showThere was magic in the air”or something like that….

    1. whitneymcn

      Other that the minor structural difference that the LOTD-style doesn’t require that the repost account follow people before they can post, looks like they’re doing the same thing.

  14. Nuno Rodrigues

    If you want to take a look on a bot which provides the scores for the main football (soccer) competitions, check