YOUR_BRANCH_ID are not real values.
HMS platform checklist (end-to-end)
Any hospital / HMS vendor can follow this ordered list. Full request/response samples for eachuse_case are in Tenant webhook contract.
Phase 0 — Prerequisites
- HMS owns patients, hospitals/branches, doctors, slots, and bookings (source of truth).
- Ondial tenant can own inbound PSTN numbers via Public API purchase (when credits allow) or dashboard assign/purchase.
- HMS exposes one public HTTPS webhook URL (e.g.
https://api.your-hms.com/ondial). - Shared secret agreed (
YOUR_SHARED_SECRET) forAuthorization: Bearer …. - (API path) Ondial API key requested and approved (
ond_live_…).
Phase 1 — Build the webhook (standard contract)
Expose onePOST endpoint. Every body includes operation + use_case. Switch on use_case.
Minimum for appointments (any scope):
Required for
global scope only:
Optional features:
Example request your HMS receives:
- HTTPS in production; respond within timeout (default 8000 ms).
- Honor Bearer secret when configured.
- Use stable IDs from your DB (
branch_id/hospital_id/doctor_id/slot_id). - Hospital/doctor-scoped agents: Ondial may inject locked
branch_id/doctor_id— accept them. patient_lookupfailure → soft fail (call continues). Slots/book failure → hard fail (do not fake success).
Phase 2 — Wire the agent in Ondial
Pick one scope per phone number:
Dashboard path: Inbound → Healthcare → Integration type HMS Custom API → Base URL + secret → Appointments ON → scope + your IDs → Save → Sync doctors → Activate.
API path (HMS backend — recommended for SaaS):
GET /api/v1/credits— check balance before buyGET /api/v1/numbers/available— browse pool inventory with per-number costPOST /api/v1/numbers/purchase— buy when credits suffice (402 insufficient_creditsif not)GET /api/v1/numbers— confirm owned numbersPOST /api/v1/inbound-agents(scope +customApiBaseUrl+ flags; passselectedVoicefromGET /api/v1/voicesorcopyVoiceFromAgentId)POST /api/v1/inbound-agents/{id}/sync-doctors(hospital/doctor only)POST /api/v1/inbound-agents/{id}/generate-scriptPOST /api/v1/inbound-agents/{id}/activatewith{ "activate": true }
hcBookingPath: custom_api automatically when scope + Custom API URL are set.
Create example (hospital):
Phase 3 — Runtime (live call)
Phase 4 — Ongoing management
Phase 5 — Go-live verification
- Webhook reachable over HTTPS with Bearer auth.
- Sync doctors returns your real doctor list (hospital/doctor scopes).
- Test call produces
doctor_slotsthenbook_appointmentin HMS logs. - Booking ID exists in your HMS.
- Google Calendar is not required on this path.
Architecture
The voice agent never calls your HMS directly. It calls Ondial mid-call APIs; Ondial POSTs to your HTTPS webhook.What you get
One Ondial phone number = one scope. Buy or assign a number, then attach the scope. Reuse the same webhook URL on many numbers.
On a global number the voice agent supports both:
- Hospital → category → doctor → slots → book
- Category → doctor → hospital → slots → book
Setup in the dashboard
1
Own an Ondial number
Purchase via Public API (
GET /credits → GET /numbers/available → POST /numbers/purchase) or in the dashboard.2
Open inbound setup
Choose category Healthcare Reception. Features start off.
3
Pick integration type
Select HMS Custom API (not Google Calendar + CRM).
4
Connect your webhook
Enter your HTTPS Base URL and optional Bearer secret. Production must use
https://.5
Enable features and scope
Turn on Appointments. Choose scope:
global, hospital (your branch/org ID), or doctor (your branch + doctor ID). Optionally enable lab report / prescription inquiry and patient lookup.6
Save, sync, activate
Save the agent. For hospital/doctor scopes, click Sync doctors from HMS. Open Review & Launch and activate.
Setup via Public API (HMS admin)
1
Get an API key
Request API access. Use
Authorization: Bearer ond_live_… from your HMS backend.2
Own Ondial numbers
From your HMS backend:
GET /api/v1/credits → GET /api/v1/numbers/available → POST /api/v1/numbers/purchase (pool inventory; credits debited). Or purchase in the dashboard. Then GET /api/v1/numbers to list owned DIDs.3
Implement your webhook
Expose one HTTPS URL. Ondial POSTs
{ operation, use_case, ...fields }. See webhook contract.4
Create an inbound agent
POST /api/v1/inbound-agents with appointmentScope, Custom API URL, and flags. Optional copyVoiceFromAgentId to copy voice/language from an existing agent. This sets Appointments ON and hcBookingPath: custom_api automatically. Agent starts inactive.5
Sync doctors (hospital / doctor only)
POST /api/v1/inbound-agents/{id}/sync-doctors. Global numbers skip this — catalogs are fetched live during the call.6
Generate script
POST /api/v1/inbound-agents/{id}/generate-script. Wait until inboundScriptStatus is ready (poll GET …/inbound-agents/{id}).7
Activate
POST /api/v1/inbound-agents/{id}/activate with { "activate": true }.Create examples
Global helpdesk numberHMS admin UX (your platform)
Hospital staff use your HMS admin UI only. Your backend calls Ondial with one tenant API key (ond_live_…). Never expose the API key to the browser.
Recommended screens
Server module (HMS codebase)
Store in HMS env (server-side only):ONDIAL_BASE_URL— e.g.https://dashboard.ondial.aiONDIAL_API_KEY—ond_live_…from Ondial API Access
branchId / doctorId on create.
Buy-number sequence
Purchase exampleCreate agent after purchase (all scopes)
UsephoneNumberId from purchase response or phoneNumber E.164 from GET /api/v1/numbers.
Global — no sync:
POST …/generate-script → POST …/activate.
Hospital — sync then script then activate:
Tenant webhook contract
Ondial POSTs JSON tocustomApiBaseUrl (the exact URL you configured — no path suffix is appended).
Requirements
- HTTPS in production
- Respond within your configured timeout (default 8000 ms; patient lookup often 5000 ms)
- When
customApiSecretis set, expectAuthorization: Bearer YOUR_SHARED_SECRET
branch_id (and doctor_id for doctor scope) on every Custom API payload when missing. Global never injects a configured hospital — the caller-selected hospital is sent as chosen on the call.
patient_lookup — read
Request:
{ "found": false }
category_list — list
Request: { "operation": "list", "use_case": "category_list" }
Response:
hospital_list — list
Request may include category_id and/or doctor_id filters.
doctor_list — list
Request may include branch_id, hospital_id, category_id, and/or doctor_id.
doctor_slots — list
Request:
book_appointment — write
Request:
record_id is also accepted as an alias for booking_id.
lab_report — read (optional feature)
When lab report inquiry is enabled on the agent:
{ "found": true, "row": { … } } or { "found": false }.
prescriptions — read (optional feature)
When prescription routing is enabled:
{ "found": true, "row": { … } } or { "found": false }.
Failures
patient_lookuptimeout or error → call still accepted (anonymous). Do not hang up.- Slots / book errors → return failure. Ondial must not confirm a booking your HMS rejected.
Validation
Related APIs
- Create inbound agent
- Update inbound agent
- Sync doctors
- List owned numbers
- Activate
- Inbound CRM lookup (dry-run read without a live call)

