Routing
Send each person to the right host, such as a specialist or someone licensed in their state.
Describe your hosts with attributes, then ask for what each person needs. Coss.com only offers times, and only books, among the hosts who match.
Describe your hosts
Attributes are your own. Use whatever your routing depends on:
await ...({
: "doctor_482",
: "Dr. Priya Raman",
: "America/New_York",
: {
: "dermatology",
: ["NY", "NJ", "CA"],
: ["en", "es"],
},
});Then create one pool for all of them. With host_filter, a new host who matches joins by themselves:
const { : } = await ...({
: "See a specialist",
: "pool",
: 30,
: { : "yes" },
});Route in the hosted booker
Add attributes to the session. Your server decides them, and the browser can't see or change them:
const { : } = await ...({
: ,
: { : "dermatology", : "CA" },
: { : "patient_77", : "Sam Lee", : "America/Los_Angeles" },
});The patient sees the times a matching doctor can take, and books one. They're never shown who else could have taken it.
Route from your own UI
Pass the same attributes when you list times and when you book:
const = { : "dermatology", : "CA" };
const { : } = await ...(, {
: "2027-01-04T00:00:00Z",
: "2027-01-18T00:00:00Z",
: .(),
});
await ...({
: ,
: "2027-01-04T15:00:00Z",
,
: { : "patient_77", : "America/Los_Angeles" },
});Choose the host yourself
When "best" depends on something only you know, such as ratings, past visits or insurance, search first, apply your own ranking, then book that host:
const { : } = await ...({
: ,
: "2027-01-04T00:00:00Z",
: "2027-01-18T00:00:00Z",
: { : "dermatology", : "CA" },
: 3,
});
const = (?. ?? []);
const = ?.[0]?.;
if ( && ) {
await ...({
: ,
,
: .,
: { : "patient_77", : "America/Los_Angeles" },
});
}If that host has just been taken, you get slot_unavailable: book your next choice.
How a host is chosen
- Every key must match.
{ specialty: "dermatology", licensed_in: "CA" }needs both. - A list means any of them.
{ licensed_in: ["CA", "NV"] }matches a host licensed in either. A host's own list matches if it contains the value. - Values are exact.
Dermatologydoesn't matchdermatology, so keep them consistent. - Among matches, it's fair. A booking goes to whoever's furthest behind their share (
weight), then whoever's waited longest. - It never falls back. If every match is taken, the time isn't offered, even if another host is free. A patient is never booked with someone who doesn't match.
If a pool also has required hosts, they're booked with a matching member, never alone in place of one.
If nobody matches, there are no times to offer, and a booking answers slot_unavailable with the reason no_hosts.
When things change
- Attributes count from the moment they change. A doctor who's no longer licensed in a state stops being offered
for it. Bookings they already have stay theirs, so find those with
coss.scheduling.bookings.listand move them if you need to. - Rescheduling stays with the same host. A patient's manage link only offers that host's times.
- You can move a booking to another host with
host, if they could have taken it. Attributes aren't checked again, since you chose them. - Taking a host off
hostskeeps them out, even if they matchhost_filter. Add them back to undo it.