Twitter bots are a fantastic way to drum up a bit of interest in your brand or website and I’ve had fantastic results myself building up an audience for the Twitter account specifically for this website. This tutorial will hopefully cover everything it takes to construct your own twitter bot that utilizes the RESTful Twitter API.
Full installation instructions can be found on the Readme.md file found on github if needed.
Replace the strings 'consumer_key' etc. with the appropriate keys and secrets generated for you and you should have successfully connected to the Twitter RESTful API. Now that we've connected we can begin to do some interesting things such as retweeting followers or searching tweets.
The first thing we need to do is create a function for searching for tweets, this function will return all recent tweets that have mentioned a specific string anywhere within the tweet.
So now that we've got the basic mechanisms in place to search for tweets, we now have to do something with them. The first interaction I'm going to show you how to do is favourite tweets.
Retweeting specific tweets is again very similar to favoriting tweets and can be useful if you want to, for instance, retweet all replies to any of the posts you make and try to improve your community presence.
Now that you've got an idea of how to favorite and retweet tweets, we can bring this together into a bot that constantly runs on a server or wherever else you choose to run it.