My Twitter Bot

… Assanganista

A short post to introduce you to something I’ve been working on like Doctor Frankenstein for the last week or so: making a Twitter Bot Mwahahaha!

The point of the Bot has been to create a way of monitoring Twitter for certain key words eg “human rights” or “legal aid”, or any mentions of your organisation’s name or, a particular #hashtag you might be interested in. Then, aggregating all the relevant tweets from across the whole of Twitter, filtering them and turning them into something that you can monitor and interact with. This in itself can be useful, although I’ve taken it a little step further here by creating an automated Twitter identity that shares the information created back onto Twitter itself

Please meet my Twitter Bot @Assanganista – who has been treading the Twittershere for a couple of weeks now – go check her out. What she does is trawl Twitter looking for tweets that contain the terms ‘Julian Assange’ and/or ‘Assange’ (including the hash-tagged ‘#Assange’). I initially chose Julian Assange as the subject given the large amounts of Twitter traffic concerning him, which has made it easier for me to test and refine the bot over a short period of time. The sheer number of tweets concerning him brings its own problems, however

She then aims to retweet the five most recent tweets every 30 minutes, although sometimes Twitter won’t allow consistent regular automatic retweeting and puts her on hold for a bit. As her profile states, she takes Twitter’s ‘Assange pulse’, 24 hours a day, 7 days a week, 365 days a year. You may have already even met her! Whatever you do, do not follow her if you fear for your sanity – she churns out absolutely tons of tweets

Other parameters (all automated) include:

She filters and removes from the Twitter trawl any tweets containing the (Assange) search terms but which are tweeted by Twitterfeed bots

She only retweets original tweets, not @replies to other users – where, for example, any of the (Assange) search terms come up as part of a conversation between two or more people

She removes any tweets that are not in the English language, so only tweets in English (this isn’t always possible where the tweet contains both English and another language – the default would be to accept the mixed-language tweet)

I’d like to say it has been easy and straightforward – it hasn’t. For one thing, Twitter actively works against people trying to utilise Twitter in ways other than conventional use. The most obvious example, and which impacts significantly on Bot creation, was the removal of RSS functionality being embedded right into every search page on Twitter last year

I’ve had no end of fun and games getting around this and haven’t found even one article that is entirely accurate so, my solution ended up mixing elements of many with a few twists and additions of my own. Once done, I used Feedburner to generate the feed

Then, it was onto Yahoo Pipes. This allows a further refining of the feed and ensures a coherent output. It removes tweets from the feed that are retweeted by others and then builds the format of the tweets that @Assanganista will retweet in the form “RT @USER [link to original tweet]”

I then linked up the Yahoo Pipe output to the @Assanganista Twitter account via Twitterfeed. I’ve also been dabbling with dlvr.it, which does the same thing as Twitterfeed, but with mixed results

Then I released her into the wild. After a glitchy beginning, she appears to be finding her feet. I’ve been tinkering behind the scenes on and off, which seems to have knocked out most of the kinks. She’s been attacked by other bots on a couple of occasions, which somehow managed to compromise what she was tweeting. Again, this is sorted out at least until the next dastardly bot wades in perhaps. Oh yes, another one of her automated functions is that she publishes The Assanganista twice daily newspaper using Paper.Li, which was very easy to set up. When I next get a bit of time I intend to add reply functionality – so that she will reply to users who @mention her or tweet to users who use a particular word, or phrase

All in all, very useful experience and I can see some quite useful (even fun) ways of applying the principles both for my own professional use and, for organisations and individuals who can use it to their own advantage