L
Leaphealth - OSDocs

Routing & Reminders

Configure who gets notified for which events and set up automatic appointment reminders.

Routing & Reminders

Notification routing rules determine which staff members receive alerts for specific events. Reminders are automated pre-appointment notifications sent to patients.

Routing Rules

Each routing rule defines how notifications for a specific event type are delivered to staff. A rule includes:

Field

Description

Event Type

Which event triggers this rule (e.g., appointment.confirmed)

Routing Strategy

How to select recipients (see below)

Target Staff Types

Which staff roles receive the notification (e.g., DOCTOR, ADMIN)

Target Value

Additional targeting criteria (strategy-dependent)

Channels

Which channels to use (WhatsApp, Email, SMS, Push)

Priority

Notification urgency: LOW, NORMAL, HIGH, or URGENT

Scope

Tenant-wide or centre-specific

Routing Strategies

Seven strategies control how recipients are selected:

Strategy

Description

ROLE

Route to all staff of specific roles (e.g., all ADMINs)

DEPARTMENT

Route to staff assigned to a specific department

RESOURCE_ASSIGNED

Route to the staff member assigned to a specific resource

ALL_ASSIGNED

Route to all staff assigned to the relevant centre/department

ON_DUTY

Route only to staff currently on duty

ESCALATION

Multi-level escalation with timeouts (see below)

BROADCAST

Send to all staff of the specified type across the tenant

Escalation Configuration

The ESCALATION strategy supports multi-level routing with automatic escalation:

  • Level 1: initially notify a specific staff type (e.g., assigned DOCTOR)
  • Timeout: if no response within the configured minutes, escalate to next level
  • Level 2: notify a different staff type (e.g., SUPERVISOR or HEAD_OF_DEPARTMENT)
  • Level 3+: additional escalation levels can be configured

Each level specifies which staff types to notify and how long to wait before escalating. This ensures critical events are never missed.

Rule Scoping

Routing rules can be scoped at two levels:

  • Tenant-Wide: applies to all centres in the hospital (centre_id is not set)
  • Centre-Specific: applies only to events at a specific centre

Each combination of tenant, centre, and event type can have only one routing rule. Centre-specific rules override tenant-wide rules for that event.


Appointment Reminders

The system sends automated reminders to patients before their appointments at three intervals:

Reminder

Timing

Channels

24-Hour Reminder

24 hours before appointment

WhatsApp, Email

2-Hour Reminder

2 hours before appointment

WhatsApp

30-Minute Reminder

30 minutes before appointment

WhatsApp

Reminder Processing

Reminders are processed by a scheduled job:

  • The reminder job runs periodically as an HTTP endpoint called by an external scheduler
  • It finds appointments with reminder times falling within a 5-minute window (plus or minus 150 seconds from the scheduled time)
  • Reminders are processed in batches of 200 appointments
  • Each reminder uses the appropriate template with appointment details (patient name, doctor, centre, slot time, booking reference)
  • All three reminder intervals are enabled by default

Reminders are only sent for appointments in CONFIRMED status. Cancelled or rescheduled appointments do not receive reminders.


Managing Routing Rules

You can create, update, list, and delete routing rules:

  • Create a rule by specifying the event type, strategy, target staff types, channels, and priority
  • Update a rule to change the strategy, targets, or channels
  • List all rules filtered by centre or tenant
  • Delete a rule to stop routing for that event type

Rules can be activated and deactivated without deleting them, allowing temporary changes to notification behavior.

routingremindersnotification-rulesalerts

Last updated on

On this page