This project automates prescription refill reminders using n8n. It sends daily reminders to patients via Email, WhatsApp, and Telegram—and tracks responses in a MySQL database.
Demo.mp4
✅ Automatically runs every day at 9:00 AM
✅ Checks which prescriptions are due for refill
✅ Sends:
- ✉️ Email Reminder
- 💬 WhatsApp Message
- 📢 Telegram Notification
✅ Updates the database to avoid duplicate reminders
✅ Fully open-source & self-hosted
Pharmacies handles millions of prescriptions monthly. Previously, many patients would forget to refill their medicines on time, risking treatment lapses.
By deploying this system:
- ⏱️ Reduced manual follow-ups by 85%
- 📈 Increased patient adherence & retention
- 💬 Boosted engagement through multichannel messaging
- 💸 Saved operational costs by automating reminders
🧠 This project became a crucial part of patient engagement automation pipeline.
[ Cron Trigger ] → [ Fetch Due Prescriptions (MySQL) ]
↓
[ Set Fields (Patient ID, Email, Name, Telegram, WhatsApp) ]
↓ ↓ ↓ ↓
[ Email ] [ WhatsApp ] [ Telegram ] [ Update reminder_sent in MySQL ]
- n8n self-hosted (Docker recommended)
- MySQL database with a
prescriptionstable - SMTP Email account
- Twilio WhatsApp API credentials (or Gupshup)
- Telegram Bot Token + Chat IDs
CREATE TABLE prescriptions (
id INT AUTO_INCREMENT PRIMARY KEY,
patient_name VARCHAR(100),
email VARCHAR(100),
Whatsappnumber VARCHAR(20),
telegram_chat_id VARCHAR(20),
medicine_name VARCHAR(100),
dosage VARCHAR(100),
purchase_date DATE,
refill_interval INT,
reminder_sent BOOLEAN DEFAULT 0
);- Clone this repo
- Import the provided prescription_reminder.json into n8n
- Add your credentials in n8n:
- MySQL
- SMTP
- Twilio (or WhatsApp provider)
- Telegram Bot
- Ensure cron is active (runs daily at 9:00 AM)
- Test manually using n8n’s UI
Hello {{$json["patient_name"]}},<br><br>
This is a reminder to refill your prescription:<br>
<b>Medicine:</b> {{$json["medicine_name"]}}<br>
<b>Dosage:</b> {{$json["dosage"]}}<br><br>
Please visit your nearest Apollo Pharmacy</a> or order online.<br><br>
<a href="https://www.example.com/">Order Online at </a>
<br>Stay healthy!<br>
Pharmacy
🩺 Hello {{$json["patient_name"]}},
This is a reminder to refill your prescription:
💊 {{$json["medicine_name"]}}
💡 Dosage: {{$json["dosage"]}}
Visit Pharmacy or order online.
Stay healthy!
🔗 https://www.example.com/