How to Write a Twitter Bot in 5 Minutes

A bot is a program that runs in the background and, when it encounters a command, it performs some action. For instance, you can have a grammar bot that looks for tweets containing misspellings and tweet the correct spelling.
A bot can automatically favorite or retweet tweets that match certain criteria. It can follow Twitter user who have tweeted a particular phrase. A brand may build an auto-reply bot that automatically responds when the brand gets a @mention on Twitter. You may have a bot that auto-sends a DM (direct message) to users who follow you on Twitter.
Writing a Twitter bot is easy and you can get one up and running in 5 minutes. Our Twitter bots run on Google servers and you don’t need any coding skills to create the bot. The bots are internally written using Google Scripts.

How to Create your own Twitter Bot

The basic idea behind bots is simple. You specify a search phrase and choose an action. The bot will find all tweets that match the search phrase and perform the associated action on those tweets.

Step A: Make an App for the Twitter Bot

  1. Create a new account at Twitter that will work as a bot. Then go toapps.twitter.com, sign-in with your new Twitter account and create a Twitter app. Give your app a name, description and put any URL in the website field. Agree to the developer terms and submit the form.
  2. Once the Twitter app has been created, click Modify App Permissions under Application Settings and change the access level to Read, Write and Access Direct Messages.
  3. Next switch to the Keys and Access Tokens tab and click the Create my Access Token button. Twitter will generate the Consumer Keys and Access tokens that we will need in a next step.

Step B: Configure your Twitter bots

  1. Go to labnol.org/bots to open the Twitter bots application. You may have to authorize the bot once.
  2. Edit the values of Twitter Consumer Key, Consumer Secret, Access Token and Access Secret that were generated in the previous step.
  3. Next you need to specify the search phrase for the bots. The app will find all new tweets that match this search phrase and process them all, one at a time. If you have the premium version, you can create up to 5 bots in one go.
  4. Click the Create to initialize the Twitter bot. That’s it. The bots are now initialized and they’ll auto-run in the background.

Twitter Bots Video Tutorial

Please watch the Twitter Bots Video Tutorial (download) for a more detailed getting started guide. It is important to note that Twitter TOS discourages automation so you may want to test the waters with a test Twitter account.
You can use Twitter search operators to find more specific tweets for processing through bots. For instance, use min_faves or min_retweets operator to filter out spammy tweets from search results. Here are some area where bots are handy:
  • If you are changing your Twitter username, set an auto-DM bot for the old account so followers can know about your new screen name.
  • If you are offline during specific hours, setup out of office replies so people can expect a delayed response.
  • Follow users or add them to a Twitter list who tweet on particular topics.

Twitter Bots – Unlock Premium Features

The Twitter bot is available in free and premium editions. The latter includes more features and you are entitled to technical support for 3 months.
FeaturesFreePremium
Favorite TweetsYesYes
Retweet TweetsYesYes
Auto-Reply to TweetsYesYes
Emoji SupportYesYes
Run bot at specific timeYesYes
Follow UsersNoYes
Add Users to Twitter ListNoYes
DM New FollowersNoYes
Reply via DMs (to users who allow)NoYes
 How often do the bots run?Once per hourEvery 15 minutes
How many Twitter bots can be created?OneFive
Support optionsNoneEmail
Buy Premium Edition
Latest
Previous
Next Post »