USE CASE · APPOINTMENT BOOKING
Appointment booking.
Your agent knows a patient needs a cleaning. It invokes OpenPhn with the clinic's number and an outcome schema. OpenPhn dials, negotiates a slot, confirms cost, and hands back a typed JSON.
OUTCOME SCHEMA
What comes back.
Declare the shape up front. OpenPhn fills every field it can, leaves optional fields null when it can't, and flags low-confidence extractions.
- ◆Handles voicemail, office closed, and transferred-to-front-desk flows
- ◆Honors callee's local business hours automatically
- ◆Idempotent — two dispatches in a row don't double-book
OUTCOME SCHEMA
{
booked: { type: "boolean" },
date: { type: "date" },
time: { type: "datetime", optional: true },
duration_min: { type: "number", optional: true },
cost_usd: { type: "number", optional: true },
practitioner: { type: "string", optional: true },
}THE FULL CALL
From objective to outcome.
REQUEST
import { OpenPhn } from "openphn"
const client = new OpenPhn({ apiKey: process.env.OPENPHN_KEY! })
const call = await client.calls.create({
to: "+14155551234",
objective: "Book a 45-minute cleaning for Sarah Chen sometime next week at Dr. Chen's office. Confirm cost.",
outcomeSchema: {
booked: { type: "boolean" },
date: { type: "date" },
time: { type: "datetime", optional: true },
duration_min: { type: "number", optional: true },
cost_usd: { type: "number", optional: true },
practitioner: { type: "string", optional: true },
},
consentType: "existing_business_relationship",
})
// call.outcome: booked, date, time, duration_min, cost_usd, practitionerWEBHOOK BODY · outcome
{
"booked": true,
"date": "2026-04-22",
"time": "2026-04-22T15:00:00-07:00",
"duration_min": 45,
"cost_usd": 180,
"practitioner": "Dr. Chen"
}