A Smart-ish Covid ChatBot πŸ€–

Ari πŸͺ - Apr 30 '20 - - Dev Community

What I built

I built a ChatBot that communicates via Twilio's API on WhatsApp. The Bot gives Covid-19 statistics from the US & the UK. It also provides some positive news articles to read in light of recent times.

Category Submission:

COVID-19 Communications
Interesting Integrations

GitHub logo ari-hacks / covid-chatbot

πŸ€– A Twilio Hackathon Project

Covid-19 ChatBot πŸ€–

MIT license Build Status

About

This is a simple ChatBot that communicates via Twilio's API on WhatsApp. The Bot gives Covid statistics from the US & the UK. It also provides some positive news articles to read in light of recent times.

How it works

Users interact with WhatsApp to communicate with the ChatBot The Bot replies to greetings along with different variations of the following questions.

Sample Questions:

Input Output
Greeting! Hi
Hi, How is it going? Good
uk confirmed cases? Confirmed Uk Cases 165221
How many uk confirmed cases? Confirmed Uk Cases 165221
What are the us covid stats? United States Stats: confirmed: 1055303 recovered: 144423 critical: 18665 deaths: 61112
uk stats United Kingdom Stats: confirmed: 165221 recovered: 1918 critical: 1559 deaths: 26097
what are the uk covid stats? United Kingdom Stats: confirmed: 165221 recovered: 1918 critical: 1559 deaths: 26097
how many us recovered cases are there? Recovered Us
…

How I built it

Stack

  • Python web framework using FastApi
  • Twilio API for WhatsApp
  • Automated responses and bot training with Chatterbot

Some Issues

  • Setting up ChatterBot produced issues with the nltk package.
  • It took some time to find the right way to set up deployment in Heroku, FastApi is a relatively new Python framework so there are not as many resources for it as Django or Flask.
  • Querying news articles based on keywords did not always produce 'good' news, however, I selected The Guardian API because you can also query on basic logic operators.
  • The Chatbot doesn't always return the desired results.

Things I learned

Since this is my first Hackathon and I am quarantined in another country I decided to use the time and opportunity to learn all new things! This is the first API I've created with python. I decided on FastApi because of its simplicity and great features (especially the built-in docs πŸ™ŒπŸΎ).

I also wanted to add a machine learning component so after some research, I landed on ChatterBot. I think it is a great introduction for someone wanting to learn some of the basics of ML.

Additional Resources/Info

I used the Guardian API to get news articles and a Covid-19 API from rapidapi.com to get coronavirus statistics.

. . . . . . . . .
Terabox Video Player