L
Leaphealth - OSDocs

Templates and variables

Attach WhatsApp and email templates to a notification rule, match template placeholders to event values, format dates and amounts, and add send conditions.

Each notification rule names the templates it sends and decides how the event's values fill them in. This page covers the template fields, the values an event provides, and the three sections that shape a message: Template names, Dates, amounts & wording and Only send when. It is for administrators who set up Notification rules.

How a message is built

From event to message

  1. 1

    Collect the event's values

    Every event provides patient_name, doctor_name and centre_name plus the values it carries, such as slot_date or bill_number.

    Outpatient_namedoctor_namecentre_name and the event's own values
  2. 2

    Format them

    The built-in formats apply unless the rule changes them.

    InDatesamounts & wording
    Outreadable datesamounts in rupeeslabels instead of codes
  3. 3

    Check the conditions

    Every check must pass on the formatted values.

    InOnly send when

    On failure: nothing is sent on any channel

  4. 4

    Rename for the template

    Values are renamed to the placeholder names each template expects.

    InTemplate names
  5. 5

    Send on each channel

    The finished values fill the template for each channel on the rule.

    InWhatsApp Template IDEmail TemplateEmail Identity

Choose the templates

In the Staff or Patient section of a rule:

Field

How to fill it

WhatsApp Template ID

Type the numeric ID of an approved WhatsApp template ("WABA template ID").

Email Template

Pick from your organisation's email templates. "No email templates found" means none exist yet.

Email Identity

Pick the verified sender address. "No verified identities found" means none is verified yet.

WhatsApp templates, email templates and sender identities are created outside LeapHealthOS. Your implementation team gives you the template IDs and sets up senders.

If a WhatsApp template has a document header, the rule automatically sends the event's pdf_url as that document, so the Bill Issued and Bill Paid events can send the invoice or statement PDF. For email, pdf_url is attached when the event has one.

The template check

Once a template is chosen, the section checks it against the event ("Checking template vars..."). For each channel it shows the template name and a chip for each placeholder the template needs. Missing ones are highlighted and listed as "Not sent by this event: ...". The line "N values from this event can be used in the message." tells you how many values you can map. "This event is not in the catalog, so its variables cannot be checked." means LeapHealthOS cannot check this event; test it by triggering the event.

A template placeholder that nothing fills usually stops the message being delivered, so fix every missing name before you rely on the rule.

Values you can use

Every event provides:

  • patient_name, doctor_name (the event's primary doctor, if any), centre_name;
  • the values the event carries, for example slot_date, slot_start_time, amount, booking_reference, bill_number, token_number, queue_name, position_in_queue, payment_link_url, pdf_url, rule_name, severity.

The template check shows the exact values for the event you are editing. The main ones per event are described in Notification events and recipient strategies.

Staff messages cannot show the patient's name

In a Staff message, patient_name contains the name of the staff member who receives the message. Leave patient_name out of staff templates, or use it only as a greeting to the recipient.

Built-in formats

These apply on every rule unless you change them.

Values

Shown as

Dates: slot_date, old_slot_date, new_slot_date, report_date

DD-MM-YYYY

Times: slot_start_time, slot_end_time, old_slot_start_time, new_slot_start_time

HH:mm

Date and time: check_in_time, started_at, completed_at, hold_expires_at, block_start_time, block_end_time

DD-MM-YYYY HH:mm

amount_rupees, amount_paid_rupees, total_amount_rupees, refund_amount_rupees, total_refund_amount_rupees, price_difference_rupees

The matching amount in rupees. The plain amount values are in paise.

payment_link_slug

The last part of payment_link_url, for templates that add the link themselves.

status, cancelled_by, payment_collection, payment_method, refund_method, check_in_method, queue_type, priority, reminder_type

A readable label, for example AT_HOSPITAL becomes "At Hospital" and STAFF (as canceller) becomes "Hospital Staff".

Times are shown in the Asia/Kolkata timezone unless you change it.

Use the rupee values for money

amount, total_amount and the other plain amounts are in paise (₹500 is sent as 50000). Map amount_rupees or total_amount_rupees into your template instead.

Dates, amounts & wording

Open Dates, amounts & wording in a section to change how values look for this rule only. The header says "Using clinic defaults" until you change something, then "Edited for this rule".

  • Defaults for this rule: Timezone, Date, Time and Date & time patterns. "Used for every date and time here unless a value below says otherwise."
  • Change how a value looks: pick an existing value and change its format. Each value shows an example.
  • Add a value: create a new value from an existing one. Give it a Value name (lowercase letters, numbers and underscores), choose what it Comes from and how it Shows as.

Shows as

Options

Date & time

Show the date as (for example DD MMM YYYY or hh:mm A) and Timezone.

Number

Multiply by, Divide by, Add and Decimals, applied in that order. Leave blank to send the number unchanged.

Word replacement

Pairs of Original value and Show instead, for example CONFIRMED shows as "Booked". Anything not listed is sent as it arrives.

Link name

The last part of a web link.

Example: to show the appointment date as "05 Jan 2026" in one rule, open Dates, amounts & wording, choose Change how a value looks, pick slot_date and set Show the date as DD MMM YYYY. Use Reset to default to undo.

A value cannot change its kind. For example you cannot turn a date into a Word replacement; the save is refused.

Template names

Your template may use different placeholder names from LeapHealthOS, for example name instead of patient_name. Open Template names in the section. For WhatsApp and Email separately, add a row with Add a name: pick Our value and type what the Template expects.

  • Renaming replaces our name; the value is no longer sent under the old name.
  • The header shows how many names are renamed, or "Needs attention" with the number still unmapped.
  • If you rename pdf_url for email, the PDF is no longer attached.

Only send when

Open Only send when to add conditions to the whole rule. "Every check has to pass or the message is skipped on all channels, with nothing recorded as a failure. Leave this empty to always send."

Click Add a check and choose:

  • Value: which event value to check.
  • Check: is, is not, is greater than, is greater than or equal to, is less than, is less than or equal to, has a value, does not have a value.
  • Value type and Compared to: Text, Number or Yes / No, and the value to compare with.

Checks run on the formatted values, so compare against what the message would show.

Goal

Check

Only tell the patient about counter payment

payment_collection is "At Hospital" (Text)

Skip zero-value bills

total_amount is greater than 0 (Number)

Only when there is a payment link

payment_link_url has a value

Watch for the warnings under each check: "is not sent by this event, so this check may never pass" and "is not a number, so this check is always false and nothing sends". An empty value counts as "does not have a value".

When a message does not arrive

LeapHealthOS does not show whether a message was delivered. Work through this list:

  1. Is there a rule for this event, audience and centre (or organisation), with at least one channel? See Notification rules.
  2. Did the strategy find anyone? See Notification events and recipient strategies.
  3. Does the recipient have a phone number (WhatsApp) or email address (Email) on their record?
  4. Is a WhatsApp Template ID set, or both Email Template and Email Identity?
  5. Did an Only send when check fail?
  6. Are all template placeholders mapped?
  7. Is the channel SMS or Push? Neither works from this screen.
notificationstemplatesvariableswhatsappemailformattingconditions

Was this page helpful?

Last updated on

On this page