Skip to main content
import type {
  WebhookEventName,
  WebhookRegistration,
  WebhookRegistrationPublic,
  WebhookPayload,
  WebhookUser,
} from '@collab-kit/utils';

WebhookEventName

Union of all webhook event types.
type WebhookEventName =
  | 'participant.joined'
  | 'participant.left'
  | 'session.started'
  | 'session.closed'
  | 'user.created'
  | 'user.updated'
  | 'user.deleted';

WebhookRegistration

A webhook registration including the signing secret. Only returned at creation time.
interface WebhookRegistration {
  id: string;
  organization_id: string;
  url: string;
  secret: string;
  events: WebhookEventName[];
  room_id: string | null;
  enabled: boolean;
  created_at: string;
  updated_at: string;
}

WebhookRegistrationPublic

A webhook registration without the secret. Returned by list, get, and update endpoints.
type WebhookRegistrationPublic = Omit<WebhookRegistration, 'secret'>;

WebhookUser

A user object with the token field stripped. Used in webhook payloads.
type WebhookUser = Omit<CollabKitUser, 'token'>;

WebhookPayload

Union of all webhook payload types. Every payload includes id, event, and timestamp fields.
type WebhookPayload =
  | ParticipantJoinedPayload    // { event, room: CollabKitRoom, user: WebhookUser }
  | ParticipantLeftPayload      // { event, room: CollabKitRoom, user: WebhookUser }
  | SessionStartedPayload       // { event, room: CollabKitRoom }
  | SessionClosedPayload        // { event, room: CollabKitRoom, users: WebhookUser[] }
  | UserCreatedPayload          // { event, room: CollabKitRoom, user: WebhookUser }
  | UserUpdatedPayload          // { event, room: CollabKitRoom, user: WebhookUser }
  | UserDeletedPayload;         // { event, room: CollabKitRoom, user: WebhookUser }

WebhookDelivery

A webhook delivery log entry. This type is defined on the server and not exported from @collab-kit/utils.
interface WebhookDelivery {
  id: string;
  webhook_id: string;
  event: string;
  payload: string;              // JSON-serialized webhook payload
  status: 'pending' | 'success' | 'failed';
  attempts: number;
  last_attempt_at: string | null;
  next_retry_at: string | null;
  status_code: number | null;
  created_at: string;
}