DEV Community

TJ-MD for WayScript

Posted on • Originally published at wayscript.com

Tutorial: Creating a COVID-19 Twitter Bot

We love when our Community members share how they are using WayScript. Erik Toor created this great video 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
Working with 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

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 you can clone
Twitter Bot COde

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

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

Video

Check out the step-by-step tutorial on Erik's YouTube Channel

If you would like to see Erik's workflow or work with his script, it is public on the WayScript market place. Also feel free to check out other scripts on the WayScript Market Place.

Top comments (2)

Collapse
 
tweettamimi profile image
Tamimi

Interesting, I never used WayScript and this looks cool! Is WayScript more like "plug-and-pay" and help you design your architecture? I'm looking into how this could potentially be helpful to building eventdriven applications.

Collapse
 
tjmd profile image
TJ-MD

Hi Tamimi - WayScript is free, so it's really "plug-and-play", there's no paywall. We'll always have a free tier so I encourage you to signup and give it a spin for some of the event driven apps you are building. Also, we have a lot of scripts you can clone to get started which are available in the free Marketplace. If you have any follow up questions, the team and community are available to help you on Discord.