Natzar Partner API Reference - v1.0.0
    Preparing search index...

    Type Alias WebhookEvent

    WebhookEvent:
        | Event<"async_consult.created", AsyncConsultEventData>
        | Event<"async_consult.consented", AsyncConsultEventData>
        | Event<"async_consult.declined", AsyncConsultEventData>
        | Event<"async_consult.queued", AsyncConsultEventData>
        | Event<"async_consult.assigned", AsyncConsultAssignedData>
        | Event<"async_consult.reassigned", AsyncConsultReassignedData>
        | Event<"async_consult.message", AsyncConsultMessageData>
        | Event<"async_consult.message_rejected", AsyncConsultMessageRejectedData>
        | Event<"async_consult.resolve_requested", AsyncConsultEventData>
        | Event<"async_consult.reopened", AsyncConsultEventData>
        | Event<"async_consult.closed", AsyncConsultClosedData>
        | Event<"async_consult.rated", AsyncConsultRatedData>
        | Event<"telehealth.created", TelehealthEventData>
        | Event<"telehealth.waiting", TelehealthEventData>
        | Event<"telehealth.ringing", TelehealthRingingData>
        | Event<"telehealth.in_progress", TelehealthEventData>
        | Event<"telehealth.completed", TelehealthEventData>
        | Event<"telehealth.cancelled", TelehealthEventData>
        | Event<"telehealth.recording_ready", TelehealthEventData>
        | Event<"telehealth.rated", TelehealthRatedData>

    Every webhook delivery body, discriminated on type. Switch on type and TypeScript narrows data to the right payload.

    Async consult lifecycle:

    • async_consult.created — consult created via the API.
    • async_consult.consented — patient accepted the consent prompt.
    • async_consult.declined — patient declined; the consult closed without ever starting.
    • async_consult.queued — consented but waiting for physician capacity.
    • async_consult.assigned — a physician took the thread.
    • async_consult.reassigned — the thread moved to another physician (SLA breach or takeover).
    • async_consult.message — a message landed on the transcript (any author, including system notices).
    • async_consult.message_rejected — a 202-accepted patient message could not be routed (thread closed underneath).
    • async_consult.resolve_requested — the physician marked it resolved; the acceptance window is running.
    • async_consult.reopened — the patient replied during the acceptance window; back to active with the same physician.
    • async_consult.closed — terminal; data.closedReason says why.
    • async_consult.rated — the patient rated the consult.

    Telehealth lifecycle:

    • telehealth.created — consult created via the API.
    • telehealth.waiting — the patient entered the waiting room.
    • telehealth.ringing — a physician was reserved; the patient's client is confirming (data.practitionerId). Not yet a call.
    • telehealth.in_progress — a physician joined; the call is live.
    • telehealth.completed — the call ended.
    • telehealth.cancelled — cancelled before/without a call.
    • telehealth.recording_ready — composite recording (and transcript, when produced) are available; GET the consult for a fresh URL.
    • telehealth.rated — the patient rated the call.
    function handle(event: WebhookEvent) {
    switch (event.type) {
    case 'async_consult.message':
    return renderMessage(event.data.asyncConsultId, event.data.message);
    case 'async_consult.closed':
    return markClosed(event.data.consult.id, event.data.closedReason);
    // …
    }
    }