All work

Appointment chatbot for dental clinics

A chat assistant on each clinic's Facebook page. Patients book, cancel or check an appointment in English or Filipino, straight against the clinic's own appointment system, and staff can step into any conversation. It also sends reminders and follow-ups.

Client
Software platform for dental clinics
My role
Main author of the back end (the part behind the scenes)
Period
Apr to Nov 2026
Status
Built and tested

Mock-up: made-up conversation

377
recorded test conversations
33 of 39
replies passed the AI judge
202
test files in the back end
2
languages, English and Filipino

The problem

Patients message dental clinics on Facebook to book, move and cancel appointments, and without a bot every message waits for a staff member to answer. A bot can answer straight away, but only if it gets the details right: a wrong date, a dentist who does not exist or a missed emergency is worse than no bot at all. So the bot had to be safe with patients as well as quick, and most of the work went into making its behaviour checkable before it reaches them.

The main workflow

Every incoming message (built with NestJS and BullMQ, not n8n)

  1. Check the message is genuine
  2. Wait 2.5 seconds for more messages
  3. Group them together
  4. Run safety checks
  5. Decide what the patient wants
  6. Handle that request
  7. Check the reply
  8. Send it and save it

What I built

  • Works out what the patient wants (booking, cancelling, checking an appointment, a question, a new patient form or an emergency) and passes it to the part that handles it. Simple replies, like picking a numbered option or saying yes to a booking, are handled by fixed rules, and AI reads the rest.
  • Books against the clinic's real appointment system, and a final check stops the bot from offering a dentist, service or time that does not exist.
  • Emergencies get an instant, fixed reply with the clinic's phone number, written in advance rather than by AI, and staff are alerted to take over.
  • Staff can take over any conversation and the bot goes quiet. When staff correct a reply, the correction is fed back to the bot as an example to learn from.
  • Reminders, come-back messages for patients who are due a visit, and follow-ups are sent automatically from appointment events.
  • Runs on Claude or OpenAI. Each clinic can have a monthly AI spending limit, with email alerts at 80% and 100% of it, and a clinic over its limit gets a hand-off to staff instead of an AI reply.
  • A test set of 377 recorded conversations, with scripts that compare the bot's answers to expected answers and to earlier results, plus an AI judge that scored 33 of 39 sampled replies as passing, at an average of 4.74 out of 5.

Tools used

  • NestJS
  • Prisma
  • Postgres
  • MySQL
  • Redis and BullMQ
  • Claude
  • OpenAI
  • Facebook webhooks
  • Terraform on AWS