Skip to main content
Optional path for hospital management systems (or any custom platform) that already own doctors, slots, booking, and patient identity. Clinics that only need Google Calendar can ignore this page. Use the normal healthcare inbound wizard and choose Google Calendar + CRM — do not select HMS Custom API. Use your platform’s hospital / branch / doctor IDs everywhere below. Placeholders like 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 each use_case are in Tenant webhook contract.

Phase 0 — Prerequisites

  1. HMS owns patients, hospitals/branches, doctors, slots, and bookings (source of truth).
  2. Ondial tenant can own inbound PSTN numbers via Public API purchase (when credits allow) or dashboard assign/purchase.
  3. HMS exposes one public HTTPS webhook URL (e.g. https://api.your-hms.com/ondial).
  4. Shared secret agreed (YOUR_SHARED_SECRET) for Authorization: Bearer ….
  5. (API path) Ondial API key requested and approved (ond_live_…).

Phase 1 — Build the webhook (standard contract)

Expose one POST 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:
Example success responses:
Rules:
  • 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_lookup failure → 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):
  1. GET /api/v1/credits — check balance before buy
  2. GET /api/v1/numbers/available — browse pool inventory with per-number cost
  3. POST /api/v1/numbers/purchase — buy when credits suffice (402 insufficient_credits if not)
  4. GET /api/v1/numbers — confirm owned numbers
  5. POST /api/v1/inbound-agents (scope + customApiBaseUrl + flags; pass selectedVoice from GET /api/v1/voices or copyVoiceFromAgentId)
  6. POST /api/v1/inbound-agents/{id}/sync-doctors (hospital/doctor only)
  7. POST /api/v1/inbound-agents/{id}/generate-script
  8. POST /api/v1/inbound-agents/{id}/activate with { "activate": true }
Create enables Appointments and 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

  1. Webhook reachable over HTTPS with Bearer auth.
  2. Sync doctors returns your real doctor list (hospital/doctor scopes).
  3. Test call produces doctor_slots then book_appointment in HMS logs.
  4. Booking ID exists in your HMS.
  5. 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:
  1. Hospital → category → doctor → slots → book
  2. Category → doctor → hospital → slots → book

Setup in the dashboard

1

Own an Ondial number

Purchase via Public API (GET /creditsGET /numbers/availablePOST /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.
Day-to-day HMS backends can do the same via Public API without opening the dashboard after the first wire-up.

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/creditsGET /api/v1/numbers/availablePOST /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 number
Hospital line
Then sync doctors and activate.

HMS 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.

Server module (HMS codebase)

Store in HMS env (server-side only):
  • ONDIAL_BASE_URL — e.g. https://dashboard.ondial.ai
  • ONDIAL_API_KEYond_live_… from Ondial API Access
All HMS UI requests go HMS browser → HMS API → Ondial Public API. Map HMS hospital/doctor records to branchId / doctorId on create.

Buy-number sequence

Purchase example

Create agent after purchase (all scopes)

Use phoneNumberId from purchase response or phoneNumber E.164 from GET /api/v1/numbers. Global — no sync:
Then POST …/generate-scriptPOST …/activate. Hospital — sync then script then activate:
Doctor — sync then script then activate:
Credit top-up stays on the Ondial dashboard or your existing billing flow; Public API exposes read balance and debit on purchase only.

Tenant webhook contract

Ondial POSTs JSON to customApiBaseUrl (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 customApiSecret is set, expect Authorization: Bearer YOUR_SHARED_SECRET
Locked ids: hospital and doctor scopes inject 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_lookupread

Request:
Response (found):
Response (not found): { "found": false }

category_listlist

Request: { "operation": "list", "use_case": "category_list" } Response:

hospital_listlist

Request may include category_id and/or doctor_id filters.

doctor_listlist

Request may include branch_id, hospital_id, category_id, and/or doctor_id.
Used mid-call on global numbers and when you run Sync doctors on hospital/doctor agents.

doctor_slotslist

Request:
Response:

book_appointmentwrite

Request:
Response:
record_id is also accepted as an alias for booking_id.

lab_reportread (optional feature)

When lab report inquiry is enabled on the agent:
Response: { "found": true, "row": { … } } or { "found": false }.

prescriptionsread (optional feature)

When prescription routing is enabled:
Response: { "found": true, "row": { … } } or { "found": false }.

Failures

  • patient_lookup timeout 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