The Birth of Congratulatron

I’ve never written a Twitter bot before

Isaac Hepworth
May 28, 2015 · 2 min read

It was Hunter who gave the initial prompt back in the day:

and so on 15 March 2013 I registered @congratsbot. Then just 26 months later @panzer pointed me at this Tweet:

and I figured I’d build it.

There are a few hundred Tweets each minute containing the words “congratulations” or “congrats”; you can get them all in real time, for free, via Twitter’s public streaming API. I figured I’d write something to do exactly that, then filter to just those Tweets amongst them which are replies. Then I could count up and identify the most “congratsed” Tweets, and have my bot throw in its own congratulations.

A few dozen lines of Python later — I used the lightweight and elegant “birdy” Python wrapper for the Twitter API — I had my bot. I exercised it for a few hours as a protected account so it wouldn’t disturb or annoy anyone while I tweaked it; then a couple of days ago I deleted all the test Tweets, switched the account to unprotected, and set it running.


I wasn’t sure what the reaction would be. Twitter, Inc., rightfully has a low tolerance for automated accounts which send unsolicited @-replies to people they don’t follow — bots like this live a precarious life on the platform. Similarly, people rightfully have a low tolerance for random @-replies from automata; too many blocks and Congratulatron would end up suspended.

Actually, though, people mostly seem to dig it

I’ve no idea how many blocks @congratsbot has received, but I see favorites and retweets rolling in.


The most surprising thing for me, building and watching this thing, has been seeing the variety of things receiving congratulations on Twitter. If you were imagining an endless stream of navel-gazing “congrats Twitter” then you’d be surprised… and @CongratsJourno (unaffiliated) may be what you’re looking for.

There’s undeniably a “Congrats Twitter”-utility to this thing:

but what my new friend has really made visible is the moving:

the real:

and the raw:


PS. Yes, I expect I should open-source this thing. Priority number one is moving it off my laptop, where it’s currently running. After that I’ll think about Github.


UPDATE: the code behind @congratsbot is available on Github at https://github.com/hepwori/congratsbot.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store