Create a funny Twitter bot using Python

Always be funny on Twitter!

See, I told you that bots have a sense of humor.

Well OK. This bot may be tasked with ONLY tweeting random jokes, but it’s still funny, right?

To get started you’ll need:

I assume:

  • The Raspberry Pi has already been set up.
  • And that it is connected to the Internet.
  • You know nothing about Python and that you just want a funny bot without all of the details.

Great! Let’s get started.

While using the Raspberry Pi create a new folder called ‘funnyBot’ and a new file called ‘’.

Open up a terminal and install Tweepy and Requests.

The terminal is located in the top-left corner. Click the command prompt icon called ‘Terminal.’

Type the following commands one at a time:

pip3 install tweepy
pip3 install requests

Go to and create an account. Provide details on how the app will be used and submit for review. The application to get a dev account took less than 24 hours for me.

Once the app has been created click on the Permissions tab and click Read, write, and direct messages.

Click the Keys and tokens tab and generate an Access token & access token secret. We will use both consumer API keys and access tokens.

Back on the Raspberry Pi double click ‘’ Paste your consumer keys and tokens in the appropriate variable:

Great! You have your program, now we need to schedule it. Install Cron GUI which allows us to schedule a task:

sudo apt-get install gnome-schedule

Next, click on the Raspberry Pi icon in the top-left corner and select System Tools > Scheduled tasks.

Create a new reoccurring task:

Provide a description and then provide the following command (your username may be different):

python3 /home/pi/Documents/funnyBot/

Confirm that the bot works: You can change the reoccurring job to be every minute to confirm that a joke tweets from your account. Don’t spam yourself!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.