Dentolize · Send Template in Expired Conversation Walkthrough
On this pageWhat this isWhy it mattersScope of this PRWhat this PR does not doStatus

Send Template in Expired Conversation

What this is

WhatsApp's Business Platform only lets a clinic send free-form messages to a patient for 24 hours after that patient's last message. Once that window closes, WhatsApp will reject anything except a pre-approved message template — a canned message Meta has reviewed and approved in advance.

Until this change, once a Dentolize WhatsApp conversation expired, the clinic's side of the chat simply went quiet. Staff could see the countdown hit zero and the "Conversation Expired" banner appear, but there was no way to act on it from inside the conversation — they had to wait for the patient to message first.

This PR adds a Send Template action to an expired conversation, on both the clinic web app and the clinic mobile app. Staff pick one of the clinic's existing messages that has an approved WhatsApp template attached, and send it straight into the expired conversation. WhatsApp accepts it because it's a template, not a free-form message — and the patient's reply reopens the normal 24-hour window.

Why it matters

A dental clinic's conversations don't stop needing follow-up just because 24 hours passed. A patient who went quiet mid-conversation, or whose appointment reminder went unanswered, previously had no way to be re-engaged over WhatsApp without leaving the app entirely (e.g. via a separate SMS, or waiting on the patient). This closes that gap for cases where a template already exists and only needs the contact's name filled in — no date, doctor, invoice, or other appointment-specific data.

Scope of this PR

  • Mobile (clinic-mobile): a new SendTemplateScreen, reachable from the "Send Template" button that now shows

in the expired-conversation header.

  • Web (clinic-web): a new SendTemplateButton that opens a modal with the same picker, next to the "Conversation

Expired" notice.

  • Server: a new sendWhatsappTemplate mutation that validates the chosen message, sends it to Meta's Graph API as

a template message, and logs it like any other outbound communication.

  • A small, deliberate restriction: only messages whose only fillable content is the contact's name (@PATIENT_NAME /

@FIRST_NAME) can be sent this way — see Which Templates Qualify for why.

What this PR does not do

  • It does not add a way to submit or approve WhatsApp templates with Meta — template approval (ConversationTemplate.status)

already exists as a concept in Dentolize and is unaffected here.

  • It does not change anything about the normal (non-expired) messaging flow.
  • It does not let staff fill in arbitrary variables (appointment date, doctor, amount, etc.) — see the eligibility page.

Status

This feature is unreleased — it ships on the branch mo/send_template_in_expired_conversation and has not gone out to customers yet. Everything in this walkthrough describes the code as it exists on that branch.