How to Write a Twitter Bot in 5 Minutes

Written by Amit Agarwal on Jul 21, 2017

Twitter Bots can do interesting things. For instance, a grammar bot can monitors tweets containing misspellings and tweet the correct spelling. You can tweet questions to @DearAssistant and the Twitter bot  responds like Siri. The @HundredZeros bot tweets links to eBooks that are free on Amazon. @WhatTheFare will tell you the Uber fare between any two locations.

Twitter Bots can automatically favorite or retweet tweets that match certain criteria. It can follow Twitter users who have tweeted a particular phrase. A brand may build an auto-reply Twitter bot that automatically responds when the brand gets a @mention on Twitter. You may have a bot that sends a DM (direct message) to users who follow you on Twitter.

Writing a Twitter bot is easy, you do not need any coding skills and you can make one live in under 5 minutes. While most Twitter bots on the Internet require some understanding in Python, Node.js or Ruby, our bots are hosted on Google servers and require “zero” programming.

Visit digitalinspiration.com/bots to get started. The Twitter Bots are internally written using Google Scripts.

How to Create your own Twitter Bot

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

Twitter Bots

Step A: Make an App for the Twitter Bot

  1. Create a new account at Twitter that will work as a bot. Then go to apps.twitter.com, sign-in with your new Twitter account and create a Twitter application. 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 digitalinspiration.com/bots to open the Twitter bots application.
  2. Enter the 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.
  4. Click Save 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.

Twitter provides certain automation rules but the gist is that your bots should not be used for spamming. Here are some legitimate uses cases where automated Twitter bots can prove handy:

  • If you are changing your Twitter username, set an auto-DM bot for the old account so your new followers get to know your new screen name.
  • If you are offline during specific hours, setup out of office replies so people can expect a delayed response.
  • You can follow users or add them to a Twitter list who tweet on particular topics or whose Twitter profile (bio) matches your search criteria.

Visit the Twitter Bots page to learn more about the premium features.


Subscribe to our Email Newsletter