Skip to main content
NewNMC’s advertising guidelines for doctors are in force from 6 Oct 2026. See what to change, and get a free compliance auditNew NMC advertising rules for doctors: what to change
AI & Automation

Red-Flag Escalation Rules in Patient Chatbots: Chest Pain, Stroke, Pregnancy Bleeding

A patient chatbot must never let a language model improvise when someone describes an emergency. This is the architecture of a rule-based interrupt layer for English, Hindi and Hinglish, and how to test it.

Red-Flag Escalation Rules in Patient Chatbots: Chest Pain, Stroke, Pregnancy Bleeding

This post is for healthtech founders, hospital digital teams and chatbot implementers who run, or are building, a patient-facing chatbot on WhatsApp or a website. It is a technical design note. It describes a layer that sits above the language model and intercepts messages that may describe an emergency, so that the model never composes a reply to them.

The need is simple. Patients write to hospital chatbots in the middle of the night, in their own words, in English, Hindi, Hinglish, or all three in one message. Some of those messages describe a heart attack, a stroke or bleeding in pregnancy. A language model asked to answer them may produce something fluent, reassuring and wrong. The design goal is not a smarter model but a deterministic path that does not depend on the model at all.

A caution first. We do not publish clinical lists in this article, and nothing here is medical advice. Which phrases constitute a red flag, and what the bot should say, are clinical decisions that your medical leadership must make, document and review. What follows is the engineering around those decisions. Where we mention symptoms, they are examples of the categories a clinical team might consider.

The principle: an interrupt layer, not a prompt

You can ask a model in its system prompt to escalate emergencies. That is worth doing as a backup. It is not a safety control, because prompts can be overridden by long conversations, odd phrasing or an injected instruction, and the model's behaviour changes between versions.

An interrupt layer is code that runs before the model on every inbound message:

  1. Receive the message (and the last few messages of context).
  2. Normalise the text.
  3. Check against the red-flag rules.
  4. If a rule matches, send the fixed emergency response, notify a human, lock the conversation out of generation, and stop.
  5. If no rule matches, pass the message to the model.

The fixed response is written, translated and approved in advance by clinicians. The model never sees the message, so it cannot be argued out of the rule.

Also run a second check on the model's output. If the model produces text that appears to give a diagnosis, a dose or reassurance about a serious symptom, block it and escalate. Two gates, one before and one after, cost very little compared with one incident.

Scope: what the bot refuses to do at all

Limit what the bot is for. The examples that make an interrupt layer necessary are exactly the ones the bot should not be handling in the first place. Define the bot's job as appointments, hospital information, preparation instructions that clinicians have approved, and routing to staff. Symptom triage is a clinical function with its own regulatory and liability implications. If your product assesses symptoms and suggests actions, take regulatory advice on whether it falls under medical-device rules in your market before launch. This is one reason the safest design is a bot that recognises danger and hands over, not one that tries to judge it.

For more on setting scope in a chatbot, see our piece on whether AI chatbots convert patients and the chatbot implementation guide.

Building the rule set

A clinical team supplies the categories and example phrasings. Engineers turn them into patterns. The working structure has four parts.

Categories. Keep a small number, each with a response and an owner. Illustrative categories a clinical team might define, not a list to adopt: chest or cardiac symptoms; stroke-like symptoms; breathing difficulty; pregnancy-related bleeding or severe pain; loss of consciousness; severe bleeding; suspected poisoning or overdose; self-harm. Public health sources can help a clinical team structure their discussion. The NHS pages on stroke symptoms and heart attack both tell people to call emergency services at once and not to drive themselves, and are examples of how a public body words the instruction. Local protocols decide what applies in India.

Patterns. For each category, a set of phrases and combinations. Rules work best as combinations of a symptom term and a context term, because single words produce false positives. For example, a body-part term near a pain term, or a breathing term near a negation of normal breathing. Avoid trying to match every phrasing; aim for high recall on the common ones, then expand from real logs.

Negation and context handling. "No chest pain" and "my father had chest pain last year" should not fire the same way as "I have chest pain now". Handle negation words and past-tense markers explicitly, and when in doubt, escalate. A false alarm costs a nurse a few minutes; a missed alert costs more.

Priority. Rules that point to the most time-critical categories run first and override everything else, including an ongoing booking flow.

Handling English, Hindi and Hinglish

Hinglish, Hindi written in Roman script, is the hard part, because there is no standard spelling. The same phrase appears as several spellings, with or without vowels, with chat abbreviations.

Practical steps:

  • Normalise before matching: lowercase, strip repeated letters ("dardddd" to "dard"), remove punctuation, standardise common substitutions, and handle both Devanagari and Roman forms.
  • Build variant lists from real messages. Start with your own chat history, with patient identifiers removed under your data policy, and ask native-speaking staff to list how people actually write each symptom.
  • Use fuzzy matching with care. An edit-distance tolerance catches typos but can match unrelated words, so limit it to longer terms and review the matches.
  • Include transliteration variants for the same word, for example the several ways of writing the Hindi for "breath" or "pain" in Roman letters, which your Hindi-speaking reviewers should enumerate.
  • Cover other languages you serve. If the bot also receives Tamil, Marathi or Bengali, each needs its own reviewed list. Do not assume the Hindi list covers them.

Voice notes are an additional route on WhatsApp. If the bot transcribes them, run the interrupt layer on the transcript, and treat a failed transcription as a reason to hand over to a human rather than to ignore the message.

Want this applied to your practice? Get a free ai & automation audit.

Book my free audit

Where the layer sits in a WhatsApp deployment

On WhatsApp, the chatbot runs on the business platform and receives messages by webhook. Place the interrupt layer in the webhook handler, before any call to the model. Meta's updated terms restrict general-purpose AI chatbot providers, but TechCrunch's report says the change does not affect businesses using AI to serve their own customers. A hospital's service bot falls in the permitted type, but a bot that behaves as an open-ended health assistant sits closer to the line and is the wrong design anyway. Check the current WhatsApp Business terms with your provider.

An example flow for a matched message:

  1. Handler detects a red-flag rule.
  2. It sends the approved emergency reply in the patient's language: advice to contact emergency services, the hospital's emergency number, and a statement that a staff member has been alerted.
  3. It creates an urgent alert for the on-duty team with the message text, time and phone number.
  4. It flags the conversation as escalated and disables automated replies until a human clears it.
  5. It logs which rule fired.

Do not ask the patient follow-up questions in the emergency reply. Do not ask them to wait for a human before contacting emergency services. The reply says what to do now, and the staff alert is in addition.

The emergency message itself

Clinicians own the wording, but a few design points are worth raising with them.

  • Keep it short: two or three sentences.
  • Put the action first.
  • Give the number to call. Emergency numbers differ by country and the hospital must supply the correct ones for each location.
  • Avoid describing a diagnosis. The bot should not tell someone they are having a stroke.
  • Write natural versions in each language, not translations.
  • Avoid emojis and decoration.

Testing the layer

Build a test suite before launch and run it after every change.

  1. Positive set. A few hundred messages across categories and languages, written or reviewed by clinicians and native speakers, all of which must trigger the right rule.
  2. Negative set. Messages that look similar but should not fire: negations, past events, third-party mentions, general questions such as "what are the symptoms of a stroke?" (to which the bot may give an approved information response or hand over).
  3. Adversarial set. Typos, slang, mixed scripts, very long messages, messages split across several short texts.
  4. Context set. Multi-turn conversations where the red flag appears in the third message.
  5. Regression harness. Automated tests run on each deployment, with a failure blocking release.

Measure recall on the positive set as the headline number, and treat the false-positive rate as a cost to manage, not the primary target. Review real triggered conversations weekly and add the new variants.

Failure modes

  • Model-only escalation. Relying on the prompt to escalate.
  • Single-language lists. A rule set tested only in English.
  • Over-matching on one word, leading to constant false alarms and a team that stops responding.
  • No on-call owner. The alert fires into an inbox nobody watches at night.
  • Stale numbers. An emergency number in the reply that changed.
  • Alert without reply. The patient hears nothing while staff are notified.
  • Logging full messages carelessly. Alerts and logs contain health data. Restrict access and apply your retention policy under India's data protection rules.

Where to start

  • Agree the bot's scope in writing: what it handles and what it only hands over.
  • Get clinicians to define categories and the approved reply in each language.
  • Implement the interrupt layer in the webhook, ahead of the model, with an output check as well.
  • Build positive, negative, adversarial and context test sets before launch.
  • Name the on-call owner for alerts, and test the alert at night.
  • Review triggered conversations weekly and extend the variant lists.

If you use AiTextBotz, where AI handles the first response and hands over to your team, ask how a rule layer like this can be configured for your workflow. Related reading: our AI chatbot service, the WhatsApp chatbot service and the WhatsApp healthcare guide.

Filed underchatbot red flag symptoms escalationpatient chatbot emergency detectionhealthcare chatbot safety rulesWhatsApp chatbot Hinglish emergency keywordshospital chatbot escalation design

About the author

Co-Founder & CTO · Gurugram, India

Arush builds the systems the rest of the company runs on — the patient-acquisition pipelines, the AI chatbots, the analytics that tie a single click to a booked appointment. If a campaign reports a number, it's because something his team built is tracking it.

Free guide · 17 pages

The Patient Acquisition Blueprint

A 90-day plan from first search to booked appointment.

The Pioneers Brief — one essay, three benchmarks, one teardown, every Thursday. Subscribe free →

Free ai & automation audit

Your next chapter starts with a conversation.

Three quick questions. We come prepared with a plan for your specialty and city.

  • A 30-minute call with a healthcare specialist
  • Your top three growth opportunities, in writing
  • Honest advice — even if that means not hiring us
  • No obligation and no hard sell
You’ll speak with a senior strategist
Consultations are hosted by Arush Thapar’s team.
Step 1 of 3Takes 30 seconds

What do you want to improve first?

Details stay privateNo obligationReply within 1 working day

Client portfolio · Healthcare websites

Work relevant to red flag escalation rules in patient chatbots chest pain stroke.

Explore client work →