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

    Interface EmbedEventDetailMap

    Per-event detail payloads: what each DOM CustomEvent's detail (and each postMessage envelope's data) contains.

    Events by surface:

    • Both: ready, closed, expired, error, rated.
    • Async chat only: consented, queued, assigned, message.
    • Telehealth only: joined, ended (plus queued while in the waiting room and assigned when a physician picks up).
    interface EmbedEventDetailMap {
        ready: { type: "agent" | "telehealth" | "async"; consultId: string };
        consented: { consultId: string };
        queued: { consultId: string };
        assigned: { consultId: string; physicianName?: string };
        message: { consultId: string; message: MessageResource };
        joined: { consultId: string };
        ended: { consultId: string };
        rated: { consultId: string; stars?: number };
        closed: { consultId: string; closedReason?: AsyncClosedReason };
        expired: { consultId: string };
        error: { code?: string; message: string };
    }
    Index
    ready: { type: "agent" | "telehealth" | "async"; consultId: string }

    The widget loaded, verified its token, and rendered.

    Type Declaration

    • type: "agent" | "telehealth" | "async"

      Which widget kind fired.

    • consultId: string

      The consult the widget is bound to. EMPTY for agent: that session is scoped to a patient, not to a consult.

    consented: { consultId: string }

    Async: the patient accepted the consent prompt.

    queued: { consultId: string }

    The consult is waiting for a physician (async: consented but no capacity yet; telehealth: patient is in the waiting room).

    assigned: { consultId: string; physicianName?: string }

    A physician took the consult.

    Type Declaration

    • consultId: string
    • OptionalphysicianName?: string

      Display name to show the patient, when available.

    message: { consultId: string; message: MessageResource }

    Async: a new message appeared on the thread (any author). Mirrors what the widget just rendered — useful for host-page unread badges.

    Type Declaration

    • consultId: string
    • message: MessageResource

      The message, without fresh attachment URLs (the widget handles those).

    joined: { consultId: string }

    Telehealth: the patient entered the live call.

    ended: { consultId: string }

    Telehealth: the call ended (the rating step may follow).

    rated: { consultId: string; stars?: number }

    The patient submitted a rating.

    Type Declaration

    • consultId: string
    • Optionalstars?: number

      The overall star rating, if stars were given.

    closed: { consultId: string; closedReason?: AsyncClosedReason }

    The consult reached a terminal state (including a declined consent, which surfaces as closed with closedReason: 'declined').

    Type Declaration

    • consultId: string
    • OptionalclosedReason?: AsyncClosedReason

      Async consults: why it closed.

    expired: { consultId: string }

    The session token expired. The widget freezes (read-only) until the host mints a fresh token server-side and calls refresh(token).

    error: { code?: string; message: string }

    Something went wrong (invalid token, disallowed origin, network…).

    Type Declaration

    • Optionalcode?: string

      Machine-readable code when the failure maps to an API error code.

    • message: string

      Human-readable description for logging.