@contio/partner-sdk - v1.7.1
    Preparing search index...

    Class WebhookEventHandler

    Typed webhook handler with fluent registration API.

    Provides type-safe .on() method for registering event handlers, with full TypeScript inference for event payloads.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Verify and handle a webhook payload.

      Verifies the signature, parses the payload, and dispatches to registered handlers.

      Parameters

      • payload: string | Buffer<ArrayBufferLike>

        Raw request body (string or Buffer)

      • signature: string

        Signature from X-Contio-Signature header

      Returns Promise<void>

      If signature verification fails or payload is invalid

    • Check if a handler is registered for a specific event type.

      Parameters

      • eventType:
            | "action_button.triggered"
            | "action_item.completed"
            | "action_item.created"
            | "action_item.updated"
            | "agenda_item.created"
            | "agenda_item.deleted"
            | "agenda_item.updated"
            | "automation.assignment.created"
            | "calendar_event.created"
            | "calendar_event.deleted"
            | "calendar_event.updated"
            | "meeting.completed"
            | "meeting.context.created"
            | "meeting.context.deleted"
            | "meeting.context.processed"
            | "meeting.created"
            | "meeting.updated"
            | "meeting_template.applied"
            | "next_step.completed"
            | "participant.added"
            | "participant.removed"
            | "session.expired"
            | "session.turn.completed"
            | "session.turn.failed"
            | "user.connection.revoked"
            | "workflow.run.completed"
            | "workflow.run.failed"
            | "workflow.run.started"
            | "workflow.step.completed"
            | "workflow.task.created"
            | "workflow.task.resolved"

      Returns boolean

    • Register a handler for a specific event type.

      The handler receives a fully typed event object based on the event type.

      Type Parameters

      Parameters

      • eventType: T

        The event type to handle (e.g., 'meeting.created')

      • handler: TypedEventHandler<T>

        Async or sync handler function

      Returns this

      this for chaining

      handler.on('meeting.created', async (event) => {
      // TypeScript knows event.data has meeting_id, workspace_id, title, etc.
      console.log('Meeting created:', event.data.title);
      });
    • Register a catch-all handler for any event type.

      This is called for every event, regardless of whether a specific handler exists. Useful for logging or metrics.

      Parameters

      • handler: (event: ContioWebhookEvent) => void | Promise<void>

        Handler function receiving any webhook event

      Returns this

      this for chaining