AI & Data · NLP

WhatsApp Message Urgency Classification

A FastText-based NLP system that classifies incoming WhatsApp messages by urgency level — helping a pharmacy client cut through chat noise and respond to what matters most, faster.

FastText Python Flask Webhook PWA NLP
WhatsApp Urgency Classification
Role
ML + Full-stack Dev
Client
Pharmacy (SMB)
Model
FastText (fine-tuned)
Status
Completed

Background

A small pharmacy was drowning in WhatsApp messages — prescription refill requests, appointment inquiries, promotional spam, and casual chats all flooding the same inbox with no way to prioritize. Staff were manually scrolling through hundreds of messages a day, often missing time-sensitive requests from patients.

Pain Points
  • Inbox flooded with spam and low-priority chats
  • Urgent patient messages getting buried
  • No system to surface what needs immediate attention
Goals
  • Auto-classify messages into urgency levels
  • Surface urgent chats on a priority dashboard
  • Alert staff with repeat notifications until handled

ML Pipeline

FastText was chosen as the model backbone — it's lightweight, fast at inference, and reliable enough for small business use cases without needing heavy infrastructure. Since FastText is pre-trained, the pipeline focused on collecting domain-specific training data and fine-tuning it to the pharmacy context.

1
Data Collection

Gathered real-world WhatsApp message samples representative of the pharmacy context — covering prescription requests, appointment questions, complaints, spam, and casual messages.

2
Data Cleaning

Removed noise such as emoji-only messages, media placeholders, and duplicate entries. Text was normalized for consistent tokenization.

3
Labelling

Each message was labelled into one of three classes: Urgent (requires immediate staff response), Normal (standard inquiry, can be queued), or Non-Urgent (spam, promotional, or irrelevant).

4
Fine-tuning

The pre-trained FastText model was fine-tuned on the labelled dataset. Because FastText is already pre-trained on large corpora, fine-tuning required minimal data and compute while still achieving reliable domain accuracy.

Why FastText?
Lightweight — runs on minimal server resources, ideal for small business hosting
Fast inference — classifies messages in milliseconds, no GPU required
Pre-trained — fine-tuning needs far less labelled data than training from scratch

How It Works

The deployed system connects directly to the pharmacy's WhatsApp through Fontee webhooks. Every incoming message triggers a classification in real-time, and the result drives what appears on the staff dashboard.

Input
WhatsApp Chat
Webhook
Fontee → JSON
Model
FastText (Flask)
Output
Urgency Label
Action
Dashboard / Notif

Urgency Classes

Urgent

Requires immediate staff response. Surfaces on the priority dashboard and triggers a repeat notification every 10 minutes until handled.

Normal

Standard inquiries that can be queued and addressed in order without time pressure.

Non-Urgent

Spam, promotional content, or casual messages with no actionable follow-up needed.

Dashboard & Notification System

Priority Dashboard

Urgent messages are surfaced front and center, showing sender info and the message content at a glance. Clears automatically once all items are handled.

Repeat Notifications

If urgent messages remain unresolved, the system re-alerts staff every 10 minutes — ensuring nothing critical gets missed during busy periods.

Quick Reply Shortcut

Each urgent message card has a one-tap shortcut that opens the conversation directly in WhatsApp, so staff can respond without any friction.

Web & PWA

Works as a standard web app on desktop. On mobile, it's installable as a PWA — giving staff a native-like experience with push notifications on their phones.

Results

Urgency Classes
3
Urgent, Normal, Non-Urgent
Notification Interval
10 min
Repeat alert until resolved
Deployment
Web+PWA
Desktop & mobile ready