@getdial/sdk - v0.21.0
    Preparing search index...

    Function parseDialMessage

    • Parse + validate a frame received from Dial. Throws on an invalid frame.

      Parameters

      • raw: string | object

      Returns
          | {
              call_id: string;
              direction: "inbound"
              | "outbound";
              from: string;
              instruction?: string | null;
              language?: string | null;
              to: string;
              type: "call_connected";
          }
          | {
              transcript: { content: string; role: "agent"
              | "user" }[];
              type: "transcript_update";
          }
          | {
              response_id: number;
              transcript: { content: string; role: "agent"
              | "user" }[];
              type: "response_required";
          }
          | {
              response_id: number;
              transcript: { content: string; role: "agent"
              | "user" }[];
              type: "reminder_required";
          }
          | { timestamp: number; type: "ping_pong" }