How to Write a Twitter Bot?

Wolfram Alpha is internally used by Twitter Bot and there are a wide range of questions this can answer you, from the city of birth of a celebrity or distance between two cities and much more. You can even ask about the weather, ask for meanings and synonyms of a word, time zones related questions and date calculations. Meet @ Dear Assistant, the Twitter Bot can be called an online version of Siri. Here is how to write a Twitter bot easily.

twitter-botWriting Twitter Bot- tips:

You can run the Twitter Bot in just 5 minutes after writing it, which is pretty simple too. If you have a brief introduction to java script, it is better, but it is not mandatory to write a Twitter Bot. Bot is mothering but a program that runs in the background. When there is a command executed, the bot processes the command. In case of Twitter, the command is the Tweets which ask a question and the bot processes it and sends a reply tweet to the Tweeter. Few years back the bot was written in PHP, Perl or python. There was a requirement for the web server to run the bot. Writing bot in perl or PHP is complicated while Google Script is much easier.

Process to write a bot:

  1. Create a new twitter account to become a bot
  2. Go to dev.twitter.com and login with the new account’s login details
  3. Give details like app name, description, website URL and call back
  4. Fill in CAPTCHA
  5. Submit the form and this is the first Twitter application
  6. Click settings and choose Read and Write as your Application Type
  7. Save changestwitter-work
  8. Make note of the Consumer Key and Consumer Secret by switching over to OAuth tool

Creating Wolfram Alpha app:

This app is required to give answers to the app.

  1. Go to developer.wolfram.com
  2. Create a new account
  3. Get the App ID
  4. This App ID is required in Google Script and you can use it only for the non-commercial purposes.
  5. For discuss licensing send an email to businessdevelopment@wloframalpha.com. 2000 queries per month are allowed.

Process to host bot on Google Drive:

1. Sign into the Google Account and go to script.google.com.
2. Choose File and copy the Twitter Bot in Google Drive
3. You need to change the values of the following

  • Twitter_Consumer_Secret
  • Twitter_Consumer_Key
  • Twitter_Handle
  • Wolfram_API_ID

4. Go to Run and initialize Twitter Bot
5. Authorize the Google script services

twitter_bot-300x300Now, the Twitter bot and Google service start to run and they can take up commands. This is available for free of cost.

Swasti Pujari
Swasti Pujari

Swasti Pujari is a versatile Engineer, blogger, content writer, and Social Media Enthusiast. With a passion for technology and creativity, she has devoted her career to solving engineering challenges and crafting engaging content. Her online presence is a strategic platform for connecting with people and sharing insights. Swasti's unique blend of technical expertise and creative expression has made her a key figure in her field. Her mantra for success is continuous learning and happiness in her work, reflecting her innovative approach to both engineering and writing.

Leave a Reply