Tutorial: Creating a COVID-19 Twitter Bot
Tags: python, tutorial, twitter, beginners
Published: 2020-04-30 14:38:57

---
title: "Tutorial: Creating a COVID-19 Twitter Bot"
canonical_url: https://wayscript.com/learn/creating-covid19-twitter-bot
---
*We love when our Community members share how they are using WayScript. Erik Toor created this great [video](https://youtu.be/6LdZRJPh7rk) using Python and WayScript, and below is a step by step tutorial. If you'd like to share what you're building with WayScript, let us know.*

##Introduction
With everything that's been going on in the world there is a need for easily accessible public information during COVID-19. Today, we'll be discussing how a college student, Erik Toor, used WayScript to help make information for COVID-19 more accessible.

##Making a COVID-19 TwitterBot
In order to make the TwitterBot, Erik utilizes a Time Trigger, a Python Script, and our Twitter Plugin. To code something like Erik there are no prerequisites but some content you might find helpful:
[Working with Twitter](https://docs.wayscript.com/library/modules/twitter)
[Working with Python](https://docs.wayscript.com/library/modules/python)

##Building the Script
With WayScript, you can set up a workflow fairly quickly.
You can create a workflow by clicking the `+ New Script` Button in the top right corner of the website.

In Erik's Script, to make a workflow he using the Time-Trigger module, Erik allows himself to Tweet COVID-19 updates daily. Modules are sort of like building blocks, to help form the foundation of our application. Then through adding the Twitter Module, and signing in one-tap with his Twitter, he is ready to post Tweets.

![Twitter Module](https://cdn.wayscript.com/blog_img/84/covid19TwitterBotFlow.png)

After creating the workflow, Erik edits the Python Module's code so that he can write up his steps for creating COVID-19 updates.

*Note: Python code can be found in his [script](https://wayscript.com/user/erik_toor/18370) you can clone*
![Twitter Bot COde](https://cdn.wayscript.com/blog_img/84/covid19TwitterBotCode.png)

To edit, a Python Module once you have placed it in your workflow, just click the Python Module > Hover Over scratch.py > Edit Code. Then you can change the Python Code however, you want!

In Erik's Python Module, he defined a Function `getCovidInfo(country)`, which gets information based off the country you request. Because he uses the loop module later in his workflow, he can add unlimited tweets for unlimited countries so that anyone can get information on COVID-19 cases in their country.

![Twitter Bot Code](https://cdn.wayscript.com/blog_img/84/covid19TwitterBotCode2.png)

You can download any Python library you need with WayScript automatically! Here, Erik writes helper functions to make web requests with Python and format his tweet. He imports `urllib.request` and `json`. He uses the urllib.request library to request data from an API written by students at his school called TrackCorona.live.

##Result
Erik is able to tweet daily updates for coronavirus. Good work!  If you want to checkout Erik's full video, see the link below.

![Twitter Feed](https://cdn.wayscript.com/blog_img/84/covid19TwitterFeed.png)

###Video
Check out the step-by-step tutorial on [Erik's YouTube Channel](https://youtu.be/6LdZRJPh7rk)

If you would like to see Erik's workflow or work with his [script](https://wayscript.com/user/erik_toor/18370), it is public on the WayScript market place. Also feel free to check out other scripts on the [WayScript Market Place](https://wayscript.com/marketplace).