Build a voice agent that answers a clinic's phone, finds the right doctor, offers real open slots, and books, reschedules or cancels the appointment, all during the call. You build it against MindCare Demo Clinic, a public sandbox at mindcare.edesy.in/demo, and the booking shows up on that page while you're still on the call. A booking call of 2 to 3 minutes costs about ₹12 to ₹18 at ₹6 a minute on pay as you go, plus telephony.
Works with: MindCare via API (custom functions): the agent calls the MindCare /v1 API with 8 HTTP custom functions · any clinic or booking system with a REST API, the same way · Google Calendar and Cal.com: native booking, no API needed (see Step 6)
Note There is no native MindCare connector. The template sets up ordinary custom functions that you can open, read and edit. The sandbox holds demo data only and resets every night at 00:00 IST.
What you'll build#
A caller says "I'd like to see a psychiatrist in Gurugram tomorrow morning". The agent checks which doctors work there, reads out up to three open times, takes the caller's name and number, books the slot and reads back the doctor, branch, day and time. Callers can also move or cancel a booking they already have.
How it works#
Caller: "Psychiatrist in Gurugram, tomorrow morning"
│
▼
Edesy voice agent (template prompt + 8 custom functions)
│ list_specialties / list_locations GET /specialties, /locations
│ find_doctors GET /doctors?specialtyId=&locationId=
│ get_open_slots GET /appointments/slots?doctorId=&...
│ book_clinic_appointment POST /appointments
│ find_my_appointments GET /appointments/lookup?phone=
│ reschedule_appointment / cancel_... POST /appointments/{id}/reschedule|cancel
▼
MindCare API https://mindcare.edesy.in/v1 (Authorization: Bearer {{vault.mindcare_api_key}})
│
▼
Booking saved with source = voice_agent ──> "Recent voice bookings" on mindcare.edesy.in/demo
Before you start#
- An Edesy voice agent account. Sign up; new accounts get ₹50 free credit, enough for several test calls.
- The MindCare sandbox details from mindcare.edesy.in/demo: the base URL
https://mindcare.edesy.in/v1and the public booking-only API key. That key can look up the catalogue and slots, and book, move or cancel appointments. It can't list patients or change doctors or branches. - About 15 minutes.
What's in the demo clinic#
| Item | Demo data |
|---|---|
| Clinic | MindCare Demo Clinic |
| Branches | Gurugram, Chattarpur (New Delhi), Bengaluru, Hyderabad |
| Specialties | Psychiatry, Clinical Psychology, De-addiction, Child & Adolescent Psychiatry, Occupational Therapy, Art Therapy |
| Doctors | Several per specialty, for example Dr. Ananya Sharma (Psychiatry). Names and schedules can change when the sandbox resets, so let the agent look them up |
| Reset | Every night at 00:00 IST. Bookings you make today are gone tomorrow |
| Reminders | Not sent from the sandbox. Nobody gets a real SMS or email |
Path A: start from the template (recommended)#
Step 1. Create the agent from the template#
- In the voice agent dashboard, go to Agents → New.
- In the template gallery, open Healthcare and pick Clinic appointment booking (live demo).
- When asked, paste the sandbox API key. It is stored in your credential vault as
mindcare_api_key; the functions reference it as{{vault.mindcare_api_key}}, so the key never appears in the prompt or the function definitions. - Create the agent.
Step 2. Look at the tools#
Open the agent's Tools tab. The template added 8 custom functions:
| Function | Method and URL (base https://mindcare.edesy.in/v1) |
Parameters | What it's for |
|---|---|---|---|
list_specialties |
GET /specialties |
none | When the caller isn't sure what kind of help they need |
list_locations |
GET /locations |
none | The 4 branches; the agent asks the city |
find_doctors |
GET /doctors?activeOnly=true |
specialtyId, locationId (both optional) | Doctors for a specialty at a branch |
get_open_slots |
GET /appointments/slots?limit=6 |
doctorId, locationId, fromDate, toDate (YYYY-MM-DD) | Real open times; the agent reads out at most 3 |
book_clinic_appointment |
POST /appointments |
doctorId, locationId, startAt, fullName, phone, reason | Books the slot, with the caller as the patient |
find_my_appointments |
GET /appointments/lookup?status=booked |
phone | Upcoming bookings for the caller, before a change |
reschedule_appointment |
POST /appointments/{{appointmentId}}/reschedule |
appointmentId, newStartAt | Moves a booking to a new open slot |
cancel_appointment |
POST /appointments/{{appointmentId}}/cancel |
appointmentId, reason | Cancels after the caller confirms |
Every function sends the header Authorization: Bearer {{vault.mindcare_api_key}}. The booking body is:
{
"doctorId": "{{doctorId}}",
"locationId": "{{locationId}}",
"startAt": "{{startAt}}",
"reason": "{{reason}}",
"source": "voice_agent",
"patient": { "fullName": "{{fullName}}", "phone": "{{phone}}" }
}
The booking function is called book_clinic_appointment, not book_appointment, so it never clashes with the built-in calendar booking tool.
Step 3. Adjust the prompt#
Open Prompt and change what makes it yours:
- the clinic name and the opening line;
- the language (the template prompt covers English and Hindi/Hinglish);
- the escalation number for distress or emergencies, used with call transfer.
Leave the date and slot rules alone: they are what stop the agent reading out a wrong time.
Step 4. Test in the browser#
- Open mindcare.edesy.in/demo in a second window. Its recent voice bookings list shows each booking's first name, doctor, branch and time.
- In the agent header, click Test Call → Browser, or open the Test Center and pick Browser Call (or Text Chat to check the logic without voice, or Phone Call to have the agent ring you). See Test Center.
- Run the test scripts below. In a browser call the agent may not know your number, so it asks for it and reads the digits back.
- After each call, open the call in call history: the transcript shows every tool call with its arguments and response.
Step 5. Put it on a phone number#
Assign a number to the agent so real calls reach it: buy an Indian number or connect one you have, then select the agent as its inbound handler. See connect a number to an agent and phone numbers for AI voice agents. On a phone call the agent offers your caller ID as the booking number.
Path B: build the tools yourself#
Use this path when the booking system is your own, or to see how one tool is put together. Here is get_open_slots built by hand:
- Open the agent's Tools tab, click Add, then Create Custom Function.
- Basic Information: name
get_open_slots; description "Get open appointment times for one doctor at one branch between two dates. Call before offering any time." - Parameters:
doctorId(string, required),locationId(string, required),fromDateandtoDate(string, required, format YYYY-MM-DD). - HTTP Configuration: method GET; URL
https://mindcare.edesy.in/v1/appointments/slots?limit=6; headerAuthorization=Bearer {{vault.mindcare_api_key}}. - Response Mapping: leave it empty. The MindCare response is small enough to pass to the agent as it is.
- Credentials: map
{{vault.mindcare_api_key}}to the vault credential that holds your key (create a Custom credential if you don't have one). - Save, then repeat for the other functions in the Step 2 table.
Placeholders use double braces, {{param}}, and are for values inside the URL path or the body, such as /appointments/{{appointmentId}}/cancel. For GET requests, don't put the parameters in the URL: the agent sends every parameter the URL doesn't already use as a query parameter (doctorId, fromDate and so on). Writing ?doctorId={{doctorId}} as well can send the value twice, which MindCare rejects. See function calling.
Data map#
| MindCare field | Generic meaning | Where it's used |
|---|---|---|
specialty.id, specialty.name |
Service or department | find_doctors filter; spoken as the service |
location.id, location.name, city |
Branch | find_doctors and get_open_slots filter; spoken as the branch |
doctor.id, doctor.fullName |
Practitioner or resource | get_open_slots, booking; spoken |
startAt |
Slot start in UTC (ISO 8601) | Sent back unchanged as startAt or newStartAt. Never built by the agent |
localStart, timezone |
Slot start in clinic time (Asia/Kolkata) | What the agent reads out |
patient.fullName, patient.phone |
Customer name and mobile | Booking body; the patient is found by phone or created |
source: "voice_agent" |
Booking channel | Marks agent bookings; the sandbox page and the Booked by voice agent filter use it |
appointment.id |
Booking reference | reschedule_appointment, cancel_appointment |
409 SLOT_TAKEN |
Slot no longer free | The agent apologises, fetches slots again and offers the next ones |
Sample agent prompt#
An excerpt; the template's full prompt is longer and includes a Hindi/Hinglish version.
You are the front desk of MindCare Demo Clinic, a mental-health clinic with branches in
Gurugram, Chattarpur (New Delhi), Bengaluru and Hyderabad. Be warm and brief. Never give
clinical advice. If the caller mentions self-harm or an emergency, give the emergency
number and offer to transfer the call. Do not continue booking.
Before any lookup, say one short line such as "One moment, checking the calendar."
Booking flow:
1. Ask what they need (a specialty or a doctor's name), then the city or branch.
2. Ask the preferred day. Resolve "tomorrow" or "next Monday" against CURRENT DATE.
3. Call get_open_slots and offer at most 3 times. Only offer times it returned.
4. Confirm the full name and mobile number. Offer {{caller_phone_number}} as the default
and read the digits back.
5. Call book_clinic_appointment with startAt exactly as returned. Never build startAt yourself.
6. Read back the doctor, branch, day and time from the booking response.
If the slot is taken (SLOT_TAKEN): apologise, fetch slots again and offer the next 2.
If nothing is free: widen the range by 7 days once, then offer another doctor.
Reschedule or cancel: find_my_appointments by phone, confirm which booking, confirm the
action, then call reschedule_appointment or cancel_appointment and read back the result.
On any other error: offer a callback from the clinic and end politely.
Test it#
Run these on a browser test call, then on a phone call once a number is assigned. Watch mindcare.edesy.in/demo as you go.
| # | Say this | Expected |
|---|---|---|
| 1 | "I'd like to book a psychiatrist in Gurugram tomorrow morning." Accept the first time offered. | The agent offers real slots, confirms your name and number, and books. The booking appears on the demo page, and the time you heard matches it |
| 2 | Book again, and while the agent is reading out times, book the same slot from a second test call or text chat. Then pick that slot. | The agent says the time was just taken, fetches slots again and offers the next ones |
| 3 | "I need to move my appointment." Call from the number you booked with, written differently if you can (for example +91 98xxx xxxxx vs 98xxxxxxxx). |
The agent finds your booking by phone, offers new slots and reschedules. The demo page shows the new time |
| 4 | "Please cancel my appointment." | The agent reads the booking back, asks you to confirm, then cancels |
| 5 | In Hindi or Hinglish: "Mujhe kal Bengaluru mein psychologist se milna hai." | The same flow, in Hindi. Times are read in clinic time |
In the Test Center, the same scenarios make a good eval suite, so you can rerun them after every prompt change.
Step 6: use your own booking system#
The same pattern works with any system that has a REST API: point the 8 functions at your endpoints, map your fields using the data map, and keep the rules (offer only returned slots, send the slot ID or start time back unchanged, confirm before cancelling).
No API? If your clinic books from Google Calendar or Cal.com, turn on the native Calendar & Scheduling capability instead; it checks free time and books without any custom functions. See Google Calendar + AI voice agent and Cal.com + AI voice agent.
What it can't do yet#
- There is no native MindCare connector. The template is 8 custom functions; you maintain them like any other function.
- The sandbox resets every night at 00:00 IST, and doctor names and schedules can change on reset.
- The sandbox doesn't send confirmation or reminder messages. In a real deployment, reminders come from your clinic system or from a reminder call.
- On a browser test call the agent may not have a caller number, so it asks for one.
- It doesn't take payments or give medical advice.
FAQ#
Does it get time zones right?
MindCare returns each slot in UTC (startAt) and in clinic time (localStart, Asia/Kolkata). The agent reads out the local time and sends startAt back unchanged, so it never converts a time itself. Relative days such as "tomorrow" are resolved against the current date the platform adds to every prompt.
Can two callers book the same slot?
No. MindCare refuses the second booking with 409 SLOT_TAKEN, and the agent offers the next free times.
Which languages work? The template prompt covers English and Hindi/Hinglish. The voice agent supports 14 Indian languages, so you can translate the prompt for Tamil, Telugu, Kannada or others.
What does a booking call cost? A booking call is usually 2 to 3 minutes: about ₹12 to ₹18 at ₹6 a minute on pay as you go, or ₹8 to ₹12 at ₹4 a minute on the Ultra plan, plus telephony. Prices exclude 18% GST. See pricing.
Is my data private in the sandbox? The sandbox is shared and holds demo data only. Don't use real patient details: use your own first name and a number you own. The demo page shows only the first name, doctor, branch and time of recent voice bookings, and everything is deleted at the nightly reset.
Can I see bookings in a MindCare admin portal? In your own MindCare workspace, yes: Appointments has a Booked by voice agent filter. The shared sandbox shows recent voice bookings on mindcare.edesy.in/demo instead.
Related#
- Blog: An AI voice agent that books clinic appointments: try the live demo
- Appointment booking agent example
- Appointment reminder call
- Function calling · Function templates · Credential vault
- Appointment booking voice agent · AI voice agent for mental-health clinics · AI receptionist
Start free · Book a demo · Don't see your booking system? Request it