Fraser Boag

The surprisingly easy way to build a reliable Twitter auto-retweet bot

Projects
6th January 2020

Back in 2018 I had the impulse to build a Twitter bot focusing on good quality/interesting “Front End Tweets”, mostly to find out if I could establish a significant number of followers with absolutely no input from me. In the year and half since, the bot (which you can find here) has gained around 500 followers – not a huge number by any means but, considering the fairly niche subject matter and people in the industry’s well-justified suspicion of such things, I’d call this a minor success.

How I built it

This is the surprisingly boring bit.

I threw around some code for a few hours, tried out a couple of different libraries, before realising that the problem I was trying to solve had already been well and truly solved for me with DigitalInspiration’s fantastic Twitter Bots Google Script Macro – so I used that!

I originally intended this version to be a proof of concept, before developing my own bot from scratch, however over a year later this tool has served its purpose beautifully and continues to do basically everything I could hope for.

The only upkeep required is to keep on top of sensible exclusions from the search parameter – the best example of which being Pakistan’s “Central Superior Services” exam (or CSS for short). A lot of tweets on this subject tend to get a large number of retweets which, of course, piques my rather simple bot’s curiosity.

How I filter for quality

Rather than just retweeting everything with the word “javascript” or “CSS” in it, I wanted to try and establish a level of quality from the outset. The simple way I did this was by only sharing content over a certain threshold of favourites and retweets. It took some fiddling to get the numbers right to begin with, but I’m fairly happy with where I’ve settled – and I genuinely now find a lot of interesting content by following my own bot.

What’s next?

As I mentioned above, DigitalInspiration’s Macro is serving its purpose nicely for the time being – however if I ever have a new language I want to try out and don’t quite have a project in mind, this is the kind of thing I’d like to revisit in order to give myself more granular control over the topics covered, and a bit more intelligence around exclusions.

In the mean time, the bot can just tick along on its own, hopefully racking up more and more followers! Be sure to check it out here.

Thanks to Icons8 for the header illustration.

What do you think?

I genuinely love to talk web. If you have any civil thoughts, corrections or comments on this note, feel free to tweet or DM @fraserboag or, if you prefer, email fraser.boag@gmail.com.

Tweet

Let me send you emails

From time to time I post things which people seem to find fairly interesting, stick your email address in the box below and you'll hear about it!