Creating Plot Twists
    Preparing search index...

    Type Alias Action

    Action:
        | { type: external; title: string; url: string }
        | { type: conferencing; url: string; provider: ConferencingProvider }
        | {
            type: auth;
            title: string;
            provider: string;
            scopes: string[];
            callback: Callback;
        }
        | { type: callback; title: string; callback: Callback }
        | {
            type: file;
            fileId: string;
            fileName: string;
            fileSize: number;
            mimeType: string;
            imageWidth?: number | null;
            imageHeight?: number | null;
        }
        | { type: thread; threadId: Uuid }
        | {
            type: plan;
            title: string;
            operations: PlanOperation[];
            callback: Callback;
        }

    Represents a clickable action attached to a thread.

    Thread actions are rendered as buttons that enable user interaction with threads. Different action types have specific behaviors and required fields for proper functionality.

    Type Declaration

    • { type: external; title: string; url: string }
      • type: external

        External web link that opens in browser

      • title: string

        Display text for the action button

      • url: string

        URL to open when clicked

    • { type: conferencing; url: string; provider: ConferencingProvider }
      • type: conferencing

        Video conferencing action with provider-specific handling

      • url: string

        URL to join the conference

      • provider: ConferencingProvider

        Conferencing provider for UI customization

    • {
          type: auth;
          title: string;
          provider: string;
          scopes: string[];
          callback: Callback;
      }
      • type: auth

        Authentication action that initiates an OAuth flow

      • title: string

        Display text for the auth button

      • provider: string

        OAuth provider (e.g., "google", "microsoft")

      • scopes: string[]

        Array of OAuth scopes to request

      • callback: Callback

        Callback token for auth completion notification

    • { type: callback; title: string; callback: Callback }
      • type: callback

        Callback action that triggers a twist method when clicked

      • title: string

        Display text for the callback button

      • callback: Callback

        Token identifying the callback to execute

    • {
          type: file;
          fileId: string;
          fileName: string;
          fileSize: number;
          mimeType: string;
          imageWidth?: number | null;
          imageHeight?: number | null;
      }
      • type: file

        File attachment action stored in R2

      • fileId: string

        Unique identifier for the stored file

      • fileName: string

        Original filename

      • fileSize: number

        File size in bytes

      • mimeType: string

        MIME type of the file

      • OptionalimageWidth?: number | null

        Intrinsic width of the image in pixels (only for image files)

      • OptionalimageHeight?: number | null

        Intrinsic height of the image in pixels (only for image files)

    • { type: thread; threadId: Uuid }
      • type: thread

        Thread reference action for navigating to a related thread

      • threadId: Uuid

        UUID of the referenced thread

    • { type: plan; title: string; operations: PlanOperation[]; callback: Callback }
      • type: plan

        Structured plan of operations for user approval

      • title: string

        Human-readable summary of the plan

      • operations: PlanOperation[]

        Operations to execute on approval

      • callback: Callback

        Callback invoked with (action, approved: boolean)

    // External action - opens URL in browser
    const externalAction: Action = {
    type: ActionType.external,
    title: "Open in Google Calendar",
    url: "https://calendar.google.com/event/123",
    };

    // Conferencing action - opens video conference with provider info
    const conferencingAction: Action = {
    type: ActionType.conferencing,
    url: "https://meet.google.com/abc-defg-hij",
    provider: ConferencingProvider.googleMeet,
    };

    // Integrations action - initiates OAuth flow
    const authAction: Action = {
    type: ActionType.auth,
    title: "Continue with Google",
    provider: AuthProvider.Google,
    scopes: ["https://www.googleapis.com/auth/calendar.readonly"],
    callback: "callback-token-for-auth-completion"
    };

    // Callback action - triggers a twist method
    const callbackAction: Action = {
    type: ActionType.callback,
    title: "📅 Primary Calendar",
    token: "callback-token-here"
    };