CareLayer
LiveAI receptionist for dental and health clinics
It sits on the clinic's website, answers patients at any hour in English and Arabic, and books them straight into the clinic's Google Calendar. Staff get an alert the moment a new patient comes in.
The problem
Clinics pay for ads, but a lot of patients message after hours and nobody replies. By morning they've booked somewhere else.
An AI can reply instantly, but in healthcare it must never make things up. It can't promise a slot, a price or an insurance deal it doesn't actually know.
What I built
- An 80-node n8n workflow behind the website chat. It sends each message to Claude, works out whether this is a real patient, and moves them to booking.
- The same logic built for WhatsApp through Meta's Cloud API, with duplicate messages filtered out before anything runs.
- Instant alerts to the clinic on Slack, email and staff phones, one alert per patient.
- A 29-node REST API behind a staff mobile app for leads and outcomes.
Answers that come from real sources
Patients also ask about UAE health rules, so CareLayer has a knowledge base on pgvector: 13 current regulator documents, 1,191 pages, 473 chunks. Before the bot answers from it, a step I call the Grounding Gate checks how strong the evidence is.
Decisions I made
- Hold first, calendar second. A Postgres row can only be claimed once, so two chats can never grab the same slot.
- A lock around calendar sync. Google can send several change notices at once. A Postgres lock makes sure only one run edits a booking, and an expired sync token (HTTP 410) triggers a full resync automatically.
- Call Claude's API directly instead of n8n's built-in AI node, so I control the exact request that goes out.
- Only re-embed what changed. Unchanged documents are skipped, and old versions are kept, so it's always clear what the bot knew and when.
- Test ideas in a lab copy first. New retrieval methods, like a retriever that rewrites the question and tries again or Anthropic's contextual retrieval, run in separate workflows before they reach the live one.
Hard problems I solved
- Keeping the AI honest. Prompt rules tell the bot not to quote prices or vouch for an insurer. The rules that can't be allowed to fail also live in code: it can't confirm an appointment the database doesn't hold, name a time it never offered or cite a document it didn't retrieve.
- Booking that works in real conversations. Code audits and full multi-message chats in English and Arabic turned up 17+ booking defects, and I fixed them all. 6 were silent, the kind that never show up as a crash. 21 unit tests and 11 live conversations confirmed the fixes.
- Retries only where they're safe. 8 calendar steps retry because repeating them changes nothing. Google's event insert doesn't, because a retry after a timeout could create a second event.
- Limits on cost and abuse. Each clinic is capped at 500 model calls and $5 of LLM spend a day. Personal data is masked before it reaches the model, and bot challenges and origin locks keep the widget from being abused.
- Market research at scale. I built an n8n workflow and a Python script that scan clinic websites in batches and record what's on them: chat tools, booking links and ad tracking. I used it to study 105 UAE dental clinics: none showed an AI-branded responder, 32% carried ad pixels and 64% had no privacy policy link. Read the public report.