WhatsApp Integration in Virtual Patient AI

Virtual Patient AI Bot โ€” Patient Interaction Flow

๐Ÿฅ VPS Bot โ€” Patient Interaction

Simulated WhatsApp conversation flow showing how a patient interacts with the Virtual Patient Clinical Decision System, including LLM processing pipeline, guardrails, and skill routing.

โœ“ OpenClaw Gateway โœ“ Claude Opus 4.6 โœ“ WhatsApp via LINK Mobility โœ“ HIPAA Compliant
๐Ÿ“ฑ Simulated WhatsApp Screenshots
Patient „Anna Mรผller“ interacts with VPS via WhatsApp. Each screen demonstrates a different bot capability. All responses include a mandatory safety disclaimer.
Screen 1 โ€” Shift Schedule Query
Screen 2 โ€” Protocol Lookup
Screen 3 โ€” ๐Ÿšซ Clinical Question BLOCKED
Screen 4 โ€” Equipment Availability
Screen 5 โ€” Incident Reporting
Screen 6 โ€” ๐Ÿ”’ PII Detection & Redaction
๐Ÿ”€ End-to-End Architecture Flow
How a patient message travels from WhatsApp through the entire system and back. Each layer adds processing, security checks, and audit logging.
๐Ÿ“ฑ Patient (Anna Mรผller) WhatsApp on mobile device
HTTPS (E2E encrypted)
๐Ÿ’ฌ WhatsApp Cloud API via LINK Mobility WASP (MED-8)
Webhook POST โ†’ implantat.md
๐Ÿ›ก๏ธ Cloudflare Tunnel TLS termination ยท gateway.implantat.md (MED-10)
localhost:19621 (no exposed ports)
๐Ÿ”ง OpenClaw Gateway Docker ยท 192.168.193.4 ยท Token auth (MED-3)
Session: agent:healthcare:main
๐Ÿง  Virtual Patient Clinical Decision System Sidecar (LLM Processing) anthropic/claude-opus-4-6 ยท System Prompt: VPS Persona
Input/Output Guardrails Applied
๐Ÿšซ Input Guardrails PII Detection ยท Blocked Topics
Block / Redact / Pass
๐Ÿ”’ PII
Redact
๐Ÿšซ Topic
Block
โœ… Skill Router Matches intent โ†’ skill module
Query data sources
๐Ÿ“‹ Protocol
Lookup
.md files
๐Ÿ‘ฅ Shift
Manager
.json
๐Ÿ”ง Equipment
Tracker
SQLite
๐Ÿ“ Incident
Reporter
.json
๐Ÿ“Š Audit Logger HIPAA ยท 90-day retention
SHA-256 hash
๐Ÿ’พ Audit Log
JSON ยท 7yr archive
Response + mandatory disclaimer appended
๐Ÿ“ค Output Filter + Disclaimer โš ๏ธ „Ich bin ein administrativer Assistent…“ appended to ALL responses
Response via same path back to patient
๐Ÿ“ฑ Patient sees response in WhatsApp
โš™๏ธ LLM Processing Pipeline โ€” Step by Step
What happens inside the system when a patient sends: „Mein Knie tut weh. Kรถnnte das eine Entzรผndung sein?“ (a clinical question that gets blocked)
1

๐Ÿ“ฑ Patient Sends Message

Anna types "Mein Knie tut weh. Kรถnnte das eine Entzรผndung sein?" in WhatsApp. The message is E2E encrypted by WhatsApp and hits the LINK Mobility WASP webhook endpoint.

2

๐ŸŒ LINK Mobility โ†’ Cloudflare โ†’ OpenClaw

LINK Mobility forwards the webhook POST to gateway.implantat.md. Cloudflare Tunnel terminates TLS and routes to localhost:19621 on the Asus GX10. OpenClaw authenticates via token ec092ddd... and routes to session agent:healthcare:main.

3

๐Ÿ”’ Input Guardrail โ€” PII Detection

The input filter scans for PII patterns: patient_name, date_of_birth, social_security, insurance_number, medical_record_number. In this message: No PII detected โ†’ PASS.

4

๐Ÿง  LLM Intent Classification (Claude Opus 4.6)

The LLM receives the message with the system prompt (VPS persona). It classifies intent:
โ€ข patient_diagnosis โ†’ MATCH
โ€ข treatment_plans โ†’ MATCH
The LLM detects this is a blocked clinical topic and generates a refusal response with redirect to medical staff.

5

๐Ÿšซ Blocked Topic Guardrail โ€” OUTPUT CHECK

Output filter verifies the LLM response does NOT contain any clinical advice, medication names, or diagnosis information. Checks pass โ€” the response is a clean refusal with staff redirect. APPROVED.

6

๐Ÿ“ค Output Filter โ€” Disclaimer Appended

The mandatory disclaimer is automatically appended: "โš ๏ธ Hinweis: Ich bin ein administrativer Assistent...". This is applied to every single response, regardless of content. Configured in healthcare-bot.yaml โ†’ guardrails.output_filter.disclaimer.

7

๐Ÿ“Š Audit Log Entry Created

A HIPAA-compliant audit entry is written: blocked_topic_triggered: true, topics: ["patient_diagnosis", "treatment_plans"], response_time_ms: 280. Entry is SHA-256 hashed for integrity. Retained 90 days online, then exported to 7-year archive.

8

๐Ÿ“ฑ Response Delivered to Patient

The formatted response travels back: OpenClaw โ†’ Cloudflare Tunnel โ†’ LINK Mobility โ†’ WhatsApp. Anna sees the friendly refusal with a redirect to Dr. Thomas Klein (pulled from shift-manager data). Total round-trip: ~800ms.

๐Ÿ“‹ Full Capability Matrix
Complete overview of what the Virtual Patient bot can and cannot do, with the skill module or guardrail responsible for each action.
Patient Request Example Message Handler Data Source Status
Staff schedule „Wer hat heute Dienst?“ shift-manager current-shifts.json โœ… Allowed
Hospital protocols „Hygieneregeln fรผr Station?“ protocol-lookup hand-hygiene.md โœ… Allowed
Equipment check „Rollstuhl verfรผgbar?“ equipment-tracker inventory.db (SQLite) โœ… Allowed
Report issue „Aufzug kaputt“ incident-reporter reports.json โœ… Allowed
Training reminder „Wann ist die nรคchste Schulung?“ training-reminder training-schedule.json โœ… Allowed
Diagnosis question „Was habe ich?“ blocked_topics โ€” ๐Ÿšซ Blocked
Treatment advice „Was soll ich nehmen?“ blocked_topics โ€” ๐Ÿšซ Blocked
Medication info „Dosierung von Ibuprofen?“ blocked_topics โ€” ๐Ÿšซ Blocked
Lab results „Meine Blutwerte?“ blocked_topics โ€” ๐Ÿšซ Blocked
Prognosis „Wie lange dauert die Heilung?“ blocked_topics โ€” ๐Ÿšซ Blocked
Insurance number „Meine Vers.-Nr. ist…“ pii_detection โ€” ๐Ÿ”’ PII Redacted
Patient name „Patient Max Mustermann…“ pii_detection โ€” ๐Ÿ”’ PII Redacted
Medical record # „Akte Nr. 12345“ pii_detection โ€” ๐Ÿ”’ PII Redacted

Scroll to Top