Example: hospital appointments
This example builds an Appointment desk use case for a hospital. Patients talk to a reception agent on the website or by phone. Workflows book the slot, confirm it, remind the patient the day before and react when the hospital’s own system changes the booking.
The hospital, its systems and all names below are examples.
What the patient experiences
Section titled “What the patient experiences”| When | What happens | Handled by |
|---|---|---|
| Mon 6 pm | The patient opens the chat on the hospital website, asks for a cardiologist this week and picks Thursday 10 am | Reception agent |
| Mon 6 pm | The slot is booked in the hospital system and a WhatsApp confirmation arrives | Booking workflow |
| Mon 6 pm | The hospital system starts the reminders for this booking | Reminders workflow |
| Wed 10 am | WhatsApp reminder: “Your appointment is tomorrow at 10:00” | Reminders workflow |
| Wed 11 am | The patient calls to move it to Friday. The agent rebooks, and the hospital system sends a reschedule event | Reception agent, then reminders workflow |
| Thu 10 am | A new reminder for Friday’s slot | New reminders run |
| Sun 10 am | “How was your visit?” | Reminders workflow |
The patient talks to one hospital assistant throughout.
The parts
Section titled “The parts”Appointment desk (use case) ├─ Reception agent entry agent: web chat, web calls, phone number, WhatsApp ├─ Appointment booking workflow, started by the reception agent └─ Appointment reminders workflow, started by the hospital system through the API ├─ Wait until 24 h before → WhatsApp reminder → wait until 2 days after → feedback ├─ Event appointment.rescheduled → end this run └─ Event doctor.cancelled (same day) → ask the patient to rebook1. Reception agent
Section titled “1. Reception agent”Create a voice agent and turn on web chat, web calls and a phone number in its channels. Connect the hospital’s WhatsApp number to it as well, so replies to reminders reach the agent.
Give it:
- instructions for greeting patients, finding the right department and collecting the patient’s name and phone number;
- a knowledge base with departments, doctors and visiting hours;
- the hospital’s MCP server with tools such as
find_slots(see Tools and MCP).
The agent does not book on its own. It starts the booking workflow, which gives you retries, a confirmation and an audit trail.
2. Appointment booking workflow
Section titled “2. Appointment booking workflow”| # | Step | Settings |
|---|---|---|
| 1 | Started by an agent | Agents that may start it: Reception agent. Input fields: patientName (text), phone (phone), doctorId (text), slotStart (text, ISO date and time with offset), reason (text). The agent: On completion, response timeout 20s |
| 2 | MCP tool | Server: hospital system. Tool: book_appointment, with inputs mapped from input.*. Store result as booking. Retries 3 |
| 3 | MCP tool | The hospital’s messaging tool send_whatsapp_template, with to = input.phone, template = "appointment_confirmed", name = input.patientName, time = input.slotStart |
| 4 | End | Outcome booked, output appointmentId = booking.appointmentId |
Messages go out through the hospital’s own messaging service, exposed as an MCP tool. The built-in Send message step is in beta; if you use it, test the workflow end to end in the test window first.
Add an On error connection from the book_appointment step to an Error handler that ends the run with outcome booking_failed.
Because the trigger waits for completion, the agent gets the outcome and the End step’s output back as the tool result. It can tell the patient “You’re booked, your reference is APT-1042” or apologise and offer another slot.
Keep the response timeout short. The agent is holding a live conversation while it waits.
3. Appointment reminders workflow
Section titled “3. Appointment reminders workflow”The hospital system starts this workflow for every booking, whether the agent, the front desk or the hospital app made it. That way every patient gets the same reminders, and the hospital system can send events that reach the right run.
| # | Step | Settings |
|---|---|---|
| 1 | API / webhook | Input fields: bookingRef, appointmentId, patientName, phone (phone), doctorId, appointmentDate (date), appointmentAt (text, ISO date and time with offset). Duplicate key: bookingRef |
| 2 | Parallel | Three branches, below |
| 3a | Wait | Wait until add_hours(input.appointmentAt, -24). Skip when days_between(now, input.appointmentAt) < 1. Only continue within Mon-Sun 08:00-20:00 |
| 4a | MCP tool | send_whatsapp_template, template appointment_reminder, to input.phone |
| 5a | Wait | Wait until add_days(input.appointmentAt, 2) |
| 6a | MCP tool | send_whatsapp_template, template visit_feedback |
| 7a | End | Outcome completed |
| 3b | Wait for event | Event appointment.rescheduled, correlation key appointmentId, time out after 90d |
| 4b | End | Outcome rescheduled |
| 3c | Wait for event | Event doctor.cancelled, correlation key doctorId, only events where event.date == input.appointmentDate, time out after 90d |
| 4c | MCP tool | send_whatsapp_template, template doctor_unavailable, asking the patient to reply or call to rebook |
| 5c | End | Outcome doctor_cancelled |
Connect the timeout outcome of both event waits to an End step with outcome expired.
An End step finishes the run and stops the other branches. So whichever comes first, the feedback message, a reschedule or a cancellation, closes the run cleanly.
Set the workflow’s Time zone (for example Asia/Kolkata) and Contact hours in Workflow settings.
How the hospital system talks to NuacemOne
Section titled “How the hospital system talks to NuacemOne”The hospital system uses a workspace secret key (vcx_sk_…), kept on its server. See the Workflows API guide.
A booking is created. Start a reminders run. The correlation is what later events use to find this run.
curl -X POST "https://api.nuacem.dev/workflow-api/public/v1/workflows/WORKFLOW_ID/runs" \ -H "X-VoiceCX-Key: $NUACEMONE_SECRET_KEY" -H "Content-Type: application/json" \ -d '{ "input": { "bookingRef": "APT-1042-20261204T1000", "appointmentId": "APT-1042", "patientName": "Asha", "phone": "+919800000000", "doctorId": "D-17", "appointmentDate": "2026-12-04", "appointmentAt": "2026-12-04T10:00:00+05:30" }, "correlation": {"appointmentId": "APT-1042", "doctorId": "D-17"} }'The patient moves the appointment. Send one event. The waiting run for APT-1042 ends with outcome rescheduled. Then start a new run for the new time, with a new bookingRef.
curl -X POST "https://api.nuacem.dev/workflow-api/public/v1/events" \ -H "X-VoiceCX-Key: $NUACEMONE_SECRET_KEY" -H "Content-Type: application/json" \ -d '{"eventName": "appointment.rescheduled", "eventId": "evt-7781", "correlation": {"appointmentId": "APT-1042"}, "data": {"appointmentId": "APT-1042", "newTime": "2026-12-05T10:00:00+05:30"}}'A doctor cancels a day. One event reaches every waiting run for that doctor. Only runs whose appointment is on that date act on it.
{ "eventName": "doctor.cancelled", "eventId": "evt-7790", "correlation": {"doctorId": "D-17"}, "data": {"doctorId": "D-17", "date": "2026-12-04"}}Put the correlation values in data as well as in correlation. correlation finds the waiting runs. The Wait for event step then checks its correlation keys against the event’s data.
A booking is cancelled outright. Cancel the run with POST /runs/{runId}/cancel, using the run id returned when it started.
eventId is your own unique id. Sending the same eventId again does nothing, so retries are safe. To hear back when runs finish, set up workflow webhooks.
Put it together as one use case
Section titled “Put it together as one use case”- Use cases → New use case → Group existing agents and workflows, name it “Appointment desk” and pick the agent and both workflows. Or start from Agent with follow-ups and fill in the drafts it creates.
- On the Agents tab, make the reception agent the entry agent.
- Open the Map. You should see the channels reaching the agent, the agent starting the booking workflow, the API trigger and the two events reaching the reminders workflow, and both workflows calling the hospital system.
- Test use case (see below).
- Submit all for review. A colleague approves the agent and both workflows.
- On the Deploy tab, copy the website widget snippet for the hospital site, and give hospital IT the workflow ids and a secret key.
Test it
Section titled “Test it”- Click Test use case. Start with a conversation with the reception agent, by chat or voice, and book a slot as a patient would.
- The booking workflow appears as a test run. Point its MCP tools at the hospital’s sandbox, because tool calls run for real.
- In the same window, start the reminders workflow from its API trigger with sample input. Set Speed to Hours as seconds, so the 24-hour wait passes in under half a minute.
- While it waits, use the Waiting on you card to send
appointment.rescheduledand check that the run ends asrescheduled.
Test runs never reach real patients and do not count in analytics. See Build, test and deploy.
Later changes
Section titled “Later changes”To add a “report ready” message, edit only the reminders workflow and publish version 2. Phone numbers, the widget and keys stay the same. Runs already waiting keep version 1; new bookings get version 2.