How To Make A Twitter Bot


This is written under the request of my awesome friend, Momo, who seems to believe in me more than I believe in myself. So, here is a brief step-by-step process on how to make your very own twitter bot. Although I’ll try to make this as detailed as possible, I guarantee that the best way to make an exceptional bot to read the Twitter API for python at . But if you are okay with a basic but equally awesome bot, then you have come to the right place. Here we go,

  1. Create the twitter account you intend to use as the bot: Simply go to: and sign up your account.

2. To get the API keys and tokens, use the sign-in information from the twitter account created above and visit . Click ‘Create New App’, fill in the necessary information and click ‘Create your Twitter application’.

Don’t forget to click the box even though I know you won’t read the agreement.

Now for the fun part :)

3. Enter the information as illustrated below. The second half basically connects the account to Twitter. The ‘api’ variable holds the authority of the account and will be used throughout the program to connect to the twitter account.

For this tutorial, we going to search for a tweet with the hashtag ‘#icecream. We will then like the tweet, retweet it and reply with “Yum yum”, because why not :).

4. To search for a tweet we use the for loop below. The variables are:

q = this holds the information we are searching for. The formatting of the query can be found here:

lang = the language of the tweet (lol duh!).

since = the starting date to begin a search for the tweet.

More attributes are found the API link I put in the beginning.

Liking and retweeting the tweet is pretty straight forward.

5. Replying is a bit trickier but basically you updating your status with a tweet mentioning the user you are replying and using the attribute ‘in_reply_to_status_id’.

Well I hope this was helpful and if you are nerd who is looking for functionality for your bot, visit: for more super cool attributes.