Thursday, 31 October 2013

How to Write a Twitter Bot in 5 Minutes?


Twitter Bot can be used for word meanings, weather conditions, language translation, conversion of time zones, data calculations, and many more. If you want to know how to write a Twitter Bot then go through this tutorial. 



For writing Twitter bot, you need to know little bit about JavaScript but it is not compulsory. Basically, a bot is a program which runs in the background and whenever it encounters a command; it processes it and then sends a reply to the tweeter in another tweet. 
Nowadays, Google scripts can be used to write the Twitter bot and host it on your Google Drive.
Here are some steps to write a Twitter Bot:

Setup a Twitter App

Firstly, create a new account at Twitter that work as a bot. Go to, sign-in with your new Twitter account and create a Twitter app. Now, give your name, description, website and callback URL to the app.
1.After the creation of Twitter app, click “Settings” and choose “Read and Write under Application Type.” It is important as you want the bot to read and post tweets. Now, click “Update” button to save changes.
2.Switch to the OAuth tool tab and make note of the Consumer Key and Consumer Secret. This will require later in your Google Apps Script.

Create a Wolfram Alpha App

1.Wolfram App is used to determine answers that users will be posing to your Twitter bot.
2.Go to, create an account and then choose “Get an App ID” to create your new app. 
3.This App ID will be needed in the Google Script. Remember that your free Wolfram Alpha App can only be used for a non-commercial purpose.

Host the Twitter bot on Google Drive

1.Create a copy of the Twitter bot into your Google Drive.
2.Edit the values of TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_HANDLE (your new Twitter account) and WOLFRAM_API_ID – you know them all from the previous steps.
3.Go to Run -> Start to initialize the Twitter bot. Click yes if the script asks you to authorize access to certain Google Script services.
4.Go to Run -> Start to actually run the Twitter bot. It will show an “Authorization Required” dialog and will redirect you to Twitter where you can grant the script access to your Twitter account.

Now, close the Google Scripts and your Twitter bot is ready to run and take commands. For more from the XpertCrewTM team, please follow us on Twitter @Techvedic or contact Techvedic’s computer support helpdesk, as per below contact-details: 
U.S. +855-859-0057 ( )
U.K. +800-635-0716 ( )
CA 1-855-749-5861 ( )
AU 1-800-197-298 ( )
And yes, we are eagerly waiting for your valuable feedback. Do write us back. We would be more than happy to help you. We are available 24/7.


Post a Comment