DEV Community

Cover image for Break the chain: SMS chatbot for awareness in times of COVID-19
Akshay090
Akshay090

Posted on

Break the chain: SMS chatbot for awareness in times of COVID-19

What I built

Hi, I have built an SMS chatbot using Twilio, which helps the user to track COVID-19 cases across different states of India, get COVID-19 news and answers some questions on COVID-19.

The main idea of this project is to spread awareness regarding COVID-19 to a large number of people. So I decided to use Twilio SMS service for this project as an SMS facility is available to almost all mobile phones, this helps the information to reach people who don't use smartphones or computers.

I named this project break-the-chain as public awareness is one of the major factors in the fight against COVID-19. People should stay alert regarding the disease spread and take precautions like social distancing to stop the spread of COVID-19 aka. break-the-chain of COVID-19.

Demo

Demo Gif

Link to Code

The complete project is opensource and you can find it at https://github.com/Akshay090/break-the-chain
Instructions to run project is in readme.

How I built it (what's the stack? did I run into issues or discover something new along the way?)

I initially went to twilio.com/code-exchange and searched for the chatbot, it showed me this project, I spent an hour with it trying to understand what it does, this project uses autopilot service of Twilio to apply NLP on SMS and calls actions bases on it. It felt too overwhelming for the basic idea I had. I learned a lot about express and pug from it.

So finally I decided to leave that project aside. I started working with flask as mentioned in this blog post and also referred this post to send and receive messages through WhatsApp, as SMS rates to an international number(bought in Twilio) cost 5 β‚Ή each. I upgraded the base project as per my requirements.

I looked across various public APIs for COVID-19 and realized I had to do web scraping to get details of COVID-19 cases of each state in India, as I didn't find any suitable working API for it.

The scraping is done on https://www.mohfw.gov.in/ through a flask script and data is stored in SQLite DB. There is also a flask script to get news from newsapi.org and store it in DB. After these two process, the user can interact with the bot from the preferred channel.

The latest addition I made to this project is a library called chatterbot it enables the bot to make small talks with a user with just 2 lines of code. This library was mentioned at the end of the second blog post mentioned above, else I would have missed it, πŸ˜… thanks Twilio.

The project is a flask app, it uses:

  • SQLite database
  • sqlAlchemy for dealing with database
  • marshmallow for (de)serialization
  • Twilio python library
  • beautifulsoup4 for web scraping
  • newsapi.org python client
  • chatterbot for fallback small talks

Categories of project

This project falls into two categories

  • COVID-19 Communications: an app to help folks communicate during this challenging time, either to stay connected or to help resolve COVID-19 related challenges.
  • Interesting Integrations: an app that integrates Twilio with at least one other API.

Additional Resources/Info

Top comments (5)

Collapse
 
carlobrillante2 profile image
Carlo Brillantes

I mean, this is cool and all, but, there are tons of services that does this already. Tons of covid trackers, it's tiring. Many web apps, messenger bots, etc..

I understand that the difference is you're using twilio sms, but can it be more unique?

I'm not mad or what, it's just, im hoping to see something unique and useful.

Even twilio has a covid tracking sample already twilio.com/blog/covid-19-tracking-...

Yes I know, you have news and other added features.. but still.

Anyway, cool app!

Collapse
 
imichaelowolabi profile image
Michael Owolabi

Nice job man

Collapse
 
brunooliveira profile image
Bruno Oliveira

Awesome!!! I'll read it later!

Collapse
 
prakh_r profile image
Prakhar Yadav

Great man! Good work πŸ‘

Collapse
 
akshay090 profile image
Akshay090

Thanks bro πŸ˜„