Clear Waters Ahead: Chatbot for Water Quality

Akhilesh Negi

DECEMBER 22, 2023

Share

INREM is dedicated to empowering rural communities across India by providing them with knowledge, policy assistance, and innovative solutions to tackle contaminated water bodies. Their goal is to ensure every rural area in India has access to clean, safe water, thereby promoting health, well-being, and sustainable livelihoods.

They recently joined Glific with vision to digitizing their program and providing assistance through Whatsapp. Their initial plan is a Glific-powered WhatsApp chatbot to send personalised advisory message about water quality of the area and how one can tackle it.  The messages will be customised based on the location of each user, which they share over WhatsApp.


We brainstormed ideas on how to make this happen while working closely with Sunder from INREM. We decided to make use of two existing features: Call a webhook and ChatGPT integration

When a person shares their location on WhatsApp, we will extract their latitude and longitude from the location and use a Call a webhook to make an API call to a different server that we will set up. This server essentially uses the location to search the dataset for a locality. It then retrieves information on the composition of several chemical components, such as iron, fluoride, arsenic, nitrate, and salinity of the water, for that locale. 

Next we’ll use  ChatGPT integration and in the custom prompt compare the quantity of these components in the water to the Bureau of Indian Standards (BIS) for water quality in order to identify any variations from the norm. Should a chemical component be discovered in large quantities, indicating its potential toxicity, the advisory message must be customised accordingly.

Here’s the prompt along with chemical values and user’s district value that was used:

You are a helpful WhatsApp bot providing water quality advice. Given the chemical contents send an advisory message based on the knowledge provided. Assume the user is not familiar with too many technical words and keep the message in 40 words. The user is from Pauri district and the chemical components found are Water salinity: 0 Nitrate: 0 Iron: 0 Fluoride: 0 Arsenic: 0
Anything above 0 is bad while 0 means good.


P.S. Since this is just POC we are going with 0 being good and anything above as bad

Additionally, WhatsApp recently introduced a brand-new interactive messaging format that allows users to send their location with a single button click. Recently, we have added support for  the same in Glific. This is useful since it used to be difficult for non-techies to share a location on WhatsApp because they frequently misunderstood the terms “live location” and “current location.”

Here’s how the complete flow looks like

The progress with INREM in developing this innovative solution is an exciting step towards enhancing rural water quality in India. As this is still proof of concept, we’ll continue refining and expanding this project. Stay tuned as we venture into a new year filled with more impactful and empowering conversations.

Leave a Reply

Discover more from Glific

Subscribe now to keep reading and get access to the full archive.

Continue reading