Whatsapp bot that gives information about statistics, procedures and news regarding the COVID-19 pandemic in Bolivia.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
I appologize in advance because some of the code and the screenshots provided are in spanish, since the project is intended for a Bolivian public and spanish is the main spoken language. I do plan to bring this bot to a larger global audience in the future.
This project started with the motivation of learning how to build a chatbot with Flask and Python. After succesfully creating a bot that could:
- Reply to basic commands
- Send images and links
- Send static hardcoded information
I decided to add a scraper script that could get updated data every time from the official Bolivian government website, as well as making calls to external APIs. All the code is hosted in Heroku for ease of use and resilience.
This bot is intended to help inform the population of my country about safety measures, official statements and current statistics. As well as providing contact resources in case of an emergency.
To get a local copy up and running follow these simple steps.
- Environment running python 3.6
- Twilio account with WhatsApp sandbox
- Heroku account
- Clone the repo
$ git clone https://github.com/lhandal/corona-bot.git
- Install required packages
$ pip install -r requirements.txt
-
Create a blank app in Heroku
-
Deploy the app in Heroku
$ heruko login #login
$ git init
$ heroku git:remote -a {heroku-project-name}
$ git add .
$ git commit -m "Final Commit Deploying to Heroku"
$ git push heroku master
In my case I used GitHub CI/CD offered by heroku to redeploy the app with every commit to my repo. You can configure this inside the app preferences!
- Copy your Heroku app URL into Twilio's sandbox
- Go to the kaffeine heroku app and paste the name of your app in there. If you don't know, after 30 minutes of inactivity, Heroku puts your app to sleep (idle) if you are using their free tier. Most of the times that is perfectly fine, since a request or ping will wake it up. Since I'm using another script to send scheduled updates, I need the app to be constantly running. Kaffeine pings your app every 25 minutes to avoid idleness.
WhatsApp Me URL
To use this bot click on this LINK
Manual Way
Simply send a WhatsApp message to +1 (415) 523-8886 with code join religious-steady. It will show a message saying connected to sandbox. Now start talking by saying Hi | Hola | Hello | Menu and it will display the followup chat options.
The implemented commands are:
- Statistics of COVID-19 cases in each Bolivian city as well as the whole country
- Possible symptoms and recommendations
- Perform a self-evaluation of symptoms to see if you have the virus.
- Donation options for fundraisers against Coronavirus in Bolivia.
- Latest official government statements.
- Latest worldwide COVID-19 news (in a very satiric way).
See the open issues for a list of proposed features (and known issues).
- Implement a NLP model to be able to hold conversations better.
- Implement other countries and worldwide statistics.
- Increase the number of input options for more robustness.
- Add an automatic daily stats sender to everyone who is subscribed.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Leandro Handal
- Email: lhandalb@gmail.com
- LinkedIn: lhandal
- Twitter: @lhandalb
- Instagram: @lhandal
Project Link: https://https://github.com/lhandal/corona-bot