All features Communications
Communications

Patient communications — technical details

All outgoing communications in MindFlow flow through the notification_queue table and are dispatched by the includes/notify.php module (called by the cron job). This means every channel — email, SMS, WhatsApp, push, Telegram — benefits from the same retry logic, delivery logging, and rate limiting.

Twilio SMS API WhatsApp Business API Web Push (VAPID) Telegram Bot API

Email

Transport

PHPMailer with SMTP. TLS/STARTTLS supported. Port and encryption configurable in Settings → Email / SMTP. Tested with Gmail SMTP, Mailgun SMTP relay, and AWS SES SMTP.

Delivery log

email_logs records every sent email: recipient, subject, body hash, sent_at, status (sent/failed), and error message on failure.

Open tracking

actions/track_open.php serves a 1×1 tracking pixel embedded in HTML emails. Open events are logged against the email_logs row and visible in the Comms Log.

From address

The From address defaults to the clinic's configured email. With white-label enabled, the clinic can use any domain they own — they must configure the correct SPF/DKIM records for that domain in their DNS.

SMS (Twilio)

Integration

Twilio REST API via the Twilio PHP Helper Library. Account SID, Auth Token, and sender number are stored in app_settings. Supports Indian 10DLC numbers for transactional messaging.

Logs

sms_logs records every outgoing SMS: recipient, message body, Twilio SID, status, cost. Status is updated via a Twilio Status Callback webhook if configured.

OTP-less SMS

OTPless (api/otpless_callback.php) can optionally replace Twilio for OTP delivery in the patient portal's passwordless login flow.

WhatsApp

Integration

WhatsApp Business API via a configured WABA provider (Twilio, D7Networks, or any provider with a WhatsApp Business API endpoint). Credentials and webhook verify token are stored in app_settings.

Message types

Appointment reminders, prescription notifications, and invoice links are sent as WhatsApp text messages or template messages (HSM). Template approval from Meta is required for outbound templates — the admin registers templates in Meta's Business Manager; app just calls them by template name.

Inbound

Inbound WhatsApp messages are not currently routed into the portal messaging system (not a two-way chat). The integration is outbound-only for notifications.

Push notifications

Standard

Web Push Notifications via the Push API (VAPID key-based). push_subscriptions stores per-device subscription objects (endpoint, p256dh, auth key) for patients who have granted notification permission in their portal browser.

Use cases

New portal message, appointment reminder, assessment request received, prescription ready. Push is the lowest-latency channel for portal-connected patients.

Telegram

Bot integration

includes/telegram_client.php + api/telegram_api.php: the clinic can connect a Telegram bot (Bot Token stored in app_settings). Patients opt-in via the portal; their Telegram chat ID is stored in patient_accounts.

Document sending

api/telegram_doc.php sends documents (prescriptions, lab reports, invoices as PDFs) directly to a patient's Telegram chat. This is the primary use case — not general messaging.

Token reveal

api/telegram_reveal_token.php: the admin can retrieve the bot's connection token to share with a patient who wants to link their Telegram account, without the token being visible in the main settings UI.

Communications log

Unified log

pages/comms_log.php shows a unified timeline of all outgoing communications (email, SMS, WhatsApp, push, Telegram) across all patients, searchable by patient, channel, date range, and status.

Retry logic

Failed notifications in notification_queue are retried up to 3 times (configurable) with exponential back-off, managed by the cron job.

Ready to see it in action?

The demo has real sample data — appointments, patients, prescriptions — so you can explore freely.

Try the demo ← All features