Inspiration for the project
COVID-19 is an infectious disease caused by a new coronavirus. To combat the wide spread of the disease around the world, many countries have decided to go in a complete lock down. At this moment, the crisis is huge as health concerns bring everyday life all over the world to a standstill. With events shutting down all over and folks being cooped up at home, many are bored and left feeling unproductive, not knowing where to go for help or company. But this too shall pass, because CoVBot is an innovative initiative to support each other remotely and feel prolific, just the kind of simple pleasure people need right now.
My grandfather was the true inspiration behind the CoVBot. Isolated and alone at his home with his daily walk to the local shop restricted, he was confined within four walls. He messaged me nearly every day on WhatsApp, the only app on his smart phone to receive updates on the virus situation or for some form of entertainment at home.
WhatsApp Messenger, or simply WhatsApp, is an American freeware, cross-platform messaging and Voice over IP (VoIP) service that allows users to send messages, make calls, and share images and all other media. It became the world's most popular messaging application by 2015 and has over 2 billion users worldwide as of February 2020, thus making it one of the best platform to connect with a lot of people worldwide. Realizing the potential power and ease of WhatsApp used by all age groups, I developed the CoVBot to transform the vulnerable feeling into a more positive and productive vibe.
Category Submission:
COVID-19 Communications
Interesting Integrations
What I built
CoVbot is a simple and intuitive Whatsapp based chatbot. The main feature of the bot is:
It can give you the latest status of COVID-19 in the country of choice in a simple and intuitive way.
Additionally, the bot can suggest fun activities to do AT HOME such as:
1) Suggest a Movie - A movie to watch from the Top 10 movies list, with a short overview of the plot and duration. Since this list is not hard coded in software this will always give you the latest updates based on current trends.
2) Suggest a TV Show - A tv show to watch from the most popular TV shows, with a short overview of the plot and ratings. Since this list is not hard coded in software this will always give you the latest updates based on current trends.
3) Suggest a Book - A book to read from the Top 10 Book list, with the blurb and cover image of the book.
4) Daily workouts - This is a video based on a 7 day workout schedule provided by CRANK gym on their Instagram Account.
Demo Link
Try it yourself
To begin testing, connect to the sandbox by sending a WhatsApp message from your device to +1 415 523 8886 with code join problem-carried.
Then say Hi and see the magic happen!!
DISCLAIMER: I host this server on my local computer, so this will only work till 4th of May 2020 and then will be disabled
How I built it
The main backend server is written in python 3.6 with Flask as the framework for the server. ngrok is used for exposing the local server to the public internet so a webhook request can be made. To retrieve the data for the latest COVID 19 Status per country, top rated Movies and TV shows, a collection of APIs are used in combination with python's request library. To keep my API keys confidential, I created a file with all my keys and only use a reference to the file in my code base (also added the file to my .gitignore ofcourse). For the Top Books I could not find an API that gives a list of Top 10 books so I decided to use web scraping with BeautifulSoup4 and lxml as the parser to get this information. The workout videos are just a link to my favorite gym's online workout videos.
Challenges
Implementing the sub menus was a bit of a challenge for me since whatsapp messages are like SMSes which is a stateless protocol. To tackle this problem I used two techniques. First I used a very primitive solution which remembered the state of the messages in between conversations using global variables. This can have nasty side effects if not used correctly, so I researched more and found a document on the Twilio's website that uses Twilio's Cookies and a Flask Session to store suggestions. This allowed me to keep track of a conversation between multiple messages. I decided to use both these methods in my code base.
Improvements
1) Make use of Object Orientedness of Python and Design Patterns to improve code architecture and DRYness
2) Remove global variables
3) Error Handling can be improved
APIs used to get the relevant data:
1) Twilio's Whatsapp API
2) COVID-19 data
3) TMDB API for Movies and TV Shows details
Top comments (0)