DEV Community

Cess Mbugua
Cess Mbugua

Posted on

Day 24 of 60: I Built an AI Clinic Receptionist That Handles Appointments, Emergencies, and Payments on WhatsApp

Today's build is the most commercially viable thing I have shipped so far.

A mid-sized private clinic in Nairobi with 40-50 appointments per day faces three costly problems every single week.

No-shows. At a 20% no-show rate with KES 2,000 per consultation, that is KES 400,000-500,000 in lost revenue every month. Gone. Because a patient forgot.

Confirmation calls. The receptionist spends 2+ hours every day calling patients just to confirm they are coming. That is 2 hours of skilled human time spent on a task a system can do automatically.

Manual booking errors. Double bookings, lost entries, missed WhatsApp messages from patients who contact the clinic outside office hours.

Meet MediFlow.


## How It Works

Patient sends WhatsApp message
↓
Twilio receives and forwards to MediFlow API
↓
Claude reads the message + patient history + clinic knowledge base
↓
Claude decides: booking, reschedule, question, emergency, or payment
↓
Response sent back to patient via WhatsApp
↓
Every message, decision, and action logged to PostgreSQL
↓
Emergencies escalated to receptionist immediately
Enter fullscreen mode Exit fullscreen mode

Real Conversations

Booking:
Patient: Hello, I would like to book an appointment with Dr. Sarah Kamau at 10am this Friday

MediFlow: Perfect, Cess! Your appointment is confirmed.
Date: Friday 6th June 2026
Time: 10:00 AM
Doctor: Dr. Sarah Kamau
Fee: KES 2,000
Location: 123 Kenyatta Avenue, Nairobi CBD

Emergency detection:
Patient: My child has been having chest pains and difficulty breathing since this morning

MediFlow: This is a medical emergency. Please call 999 immediately or go to the nearest hospital emergency department right away.

Simultaneously the receptionist receives: MEDIFLOW ESCALATION — Patient experiencing chest pain and difficulty breathing; please respond directly.

NHIF question:
Patient: Do you accept NHIF?

MediFlow: Yes, we accept NHIF for outpatient consultations. Bring your NHIF card to your appointment.




**

What the System Decides vs What Humans Decide**

System decides automatically:
Slot availability. Appointment confirmation. Reminder sending. Clinic questions from knowledge base. Outstanding balance enforcement with M-PESA instructions.

Human decides always:
Emergency symptoms. Balance disputes. Complex or ambiguous cases.


The Numbers

Metric Before MediFlow After MediFlow
No-show rate 20%+ Projected 5-8%
Confirmation calls 2+ hours per day Near zero
After-hours enquiries 0% handled 100% handled
Monthly revenue lost KES 400,000-500,000 KES 80,000-150,000

Tech Stack

Twilio WhatsApp Business API. Claude API (claude-opus-4-5). FastAPI. PostgreSQL. SQLAlchemy. n8n for reminder scheduling. Railway for cloud deployment.


What I Learned

The hardest part was not the booking logic. It was teaching Claude to read the emotional tone of a message and decide whether it is a routine enquiry or a genuine emergency that needs immediate human intervention.

The difference between "my child has a fever" and "my child has chest pain and difficulty breathing" is not just vocabulary. It is the difference between a standard response and an immediate escalation. Getting that boundary right required careful prompt engineering and extensive testing.

Also: building for Swahili speakers was a deliberate decision. If the system only works in English it does not work for most of the patients it is supposed to serve.


🔗 Full project on GitHub → https://github.com/mbuguacessy-glitch

36 more to go.

python #fastapi #claudeapi #twilio #whatsapp #healthcare #kenya #automation #buildinpublic #learninpublic #100DaysOfCode

Top comments (0)