Integration Flows
Step-by-step guides showing how Bot MD integrates with your scheduling system for common patient journeys.
Initial Setup
Connect your Scheduling System with Bot MD
API Key Authentication
Your scheduling system provides a unique API key for every hospital. Each facility has its own API key.
Appointment Type Configuration
If your scheduling system does not maintain appointment types, a default appointment type per calendar is set up to maintain consistency for further integrations.
Reschedule Cutoff Time
Configure the reschedule cutoff time during setup.
Calendar Sync
GETFetch and store the calendars, maintaining sync separately.
/api/v1/calendarsConfigure Webhook
WEBHOOKSet up webhook endpoint to receive appointment and patient updates.
Note: Location can be inferred from API key. Branch support is not required - each facility has its own API key.
User Journey 1: Book Appointment
Patient schedules a new appointment via chat
Collect Patient Info
Bot MD collects user's basic information: Name, DOB, Mobile, Gender, National ID
Create/Update Contact
Bot MD creates or updates the information of the Contact entity at its end.
User Expresses Intent
User expresses intent to book an appointment.
Get Availability
GETBot MD invokes your API to get available time slots for the selected calendar and appointment type.
/api/v1/availabilityRequest: month, appointment_type_id, calendar_id
Response: date and time slots
User Selects Slot
Bot MD presents available dates and times, allowing user to select preferred slot.
Create Appointment
POSTThe chosen date and time slot is sent to your API to create an appointment.
/api/v1/appointmentsSend Confirmation
The appointment booked is sent back as a confirmation message to the user's device.
User Journey 2: Cancel Appointment
Patient cancels an existing appointment via chat (e.g., "I want to cancel an appointment")
User Expresses Intent
User expresses intent to cancel an appointment via chat.
Retrieve Stored Appointments
Bot MD retrieves the patient's appointments from its own stored data (using previously saved appointmentId, patientId, temporaryPatientId).
User Selects Appointment
Bot MD presents the appointments to the user, allowing them to choose which appointment to cancel.
Cancel Appointment
PUTBot MD sends the cancellation request to your API using the stored appointmentId.
/api/v1/appointments/:id/cancelRequest: appointment_id (from Bot MD's stored data)
Send Confirmation
The appointment cancelled is sent back as a confirmation message to the user's device.
Note: Bot MD uses its own stored data (appointmentId, patientId) from previous bookings or webhook events. No need to call Get Patient or Get Appointments endpoints.
User Journey 3: Reschedule Appointment
Patient reschedules an existing appointment via chat (e.g., "I want to reschedule an appointment")
User Expresses Intent
User expresses intent to reschedule an appointment via chat.
Retrieve Stored Appointments
Bot MD retrieves the patient's appointments from its own stored data (using previously saved appointmentId, patientId, temporaryPatientId).
User Selects Appointment
Bot MD presents the appointments to the user, allowing them to choose which appointment to reschedule.
Get New Available Slots
GETBot MD fetches available dates and time slots for rescheduling.
/api/v1/availabilityRequest: month, appointment_type_id, calendar_id
Response: date and time slots
User Selects New Slot
Bot MD presents available dates and times, allowing user to select preferred new slot.
Reschedule Appointment
PUTBot MD sends the reschedule request to your API using the stored appointmentId.
/api/v1/appointments/:id/rescheduleRequest: appointment_id (from Bot MD's stored data), new datetime
Send Confirmation
The appointment rescheduled is sent back as a confirmation message to the user's device.
Note: Bot MD uses its own stored data (appointmentId, patientId) from previous bookings or webhook events. No need to call Get Patient or Get Appointments endpoints.
User Journey 4: Admin Sync (Webhook)
Admin books/modifies/cancels appointment for a patient in your scheduling system
Admin Action
Your scheduling system books/modifies/cancels an appointment internally.
Trigger Webhook
WEBHOOKYour scheduling system triggers Bot MD's pre-configured webhook endpoint.
Request: action: scheduled/rescheduled/cancelled, patient_id, appointment_id, email, phone, name, DoB
Bot MD Processes Event
Bot MD captures the event, creates a contact entity locally if patient doesn't exist, and associates the appointment_id to the contact entity.
Notify Patient
Bot MD sends a confirmation message to the user via Messenger/Viber/SMS.
User Journey 5: Queue Check-in (Webhook)
Patient arrives for appointment and checks in with Queue
Patient Arrives
Patient arrives at the facility for their appointment.
Trigger Queued Webhook
WEBHOOKYour scheduling system triggers a webhook to Bot MD to update the status.
Request: action: queued, queue_number, patient_id, appointment_id, email, phone, name, DoB
Bot MD Processes Event
Bot MD captures the event, creates a contact entity locally if patient doesn't exist, and associates the appointment_id to the contact entity.
Update Appointment Status
Bot MD updates the status of its appointment as SHOW.
Permanent Patient Creation (Webhook)
Patient gets a permanent ID assigned/created in your scheduling system
Permanent ID Assigned
Patient gets a permanent ID assigned/created in your scheduling system.
Trigger patientCreated Webhook
WEBHOOKYour scheduling system triggers a webhook to update the permanent ID at Bot MD's end.
Request: patientId, temporaryPatientId
Update Patient Entity
The new patient Entity ID is updated on Bot MD's end, linking the temporary patient record to the permanent patient ID.
Integration Checklist
Required Endpoints
- • GET /api/v1/calendars
- • GET /api/v1/availability
- • POST /api/v1/appointments
- • PUT /api/v1/appointments/:id/reschedule
- • PUT /api/v1/appointments/:id/cancel
Note: Bot MD uses its own stored data for patient and appointment lookups during cancel/reschedule flows.
Webhook Events
- •
appointmentCreated- New appointment created - •
appointmentRescheduled- Appointment time changed - •
appointmentCanceled- Appointment cancelled - •
patientCreated- Permanent patient ID assigned - •
Queued- Patient checked in (includes queueNumber)