Avnology ID
SDKsTypeScript SDKType Reference

Webhook Types

TypeScript type definitions for Webhook, WebhookDelivery, and WebhookEvent.

Webhook Types

Webhook

interface Webhook {
  id: string;
  url: string;
  events: string[];
  organizationId: string | null;
  active: boolean;
  secret: string;          // Only returned on creation
  metadata: Record<string, string>;
  createdAt: string;
  updatedAt: string;
}

WebhookDelivery

interface WebhookDelivery {
  id: string;
  webhookId: string;
  event: string;
  status: "success" | "failed" | "pending";
  statusCode: number | null;
  requestBody: string;
  responseBody: string | null;
  durationMs: number | null;
  attempts: number;
  nextRetryAt: string | null;
  createdAt: string;
}

WebhookEvent

The payload delivered to your webhook endpoint.

interface WebhookEvent {
  id: string;             // Unique event ID (idempotency key)
  type: string;           // Event type (e.g., "user.created")
  timestamp: string;      // ISO 8601 timestamp
  data: Record<string, unknown>;  // Event-specific payload
  organizationId: string | null;
}

Event payload examples

// user.created
{
  id: "evt_abc123",
  type: "user.created",
  timestamp: "2026-04-08T12:00:00Z",
  data: {
    userId: "usr_abc123",
    email: "[email protected]",
    name: { first: "Jane", last: "Doe" },
    organizationId: "org_abc123",
  },
}

// session.created
{
  id: "evt_def456",
  type: "session.created",
  timestamp: "2026-04-08T12:05:00Z",
  data: {
    sessionId: "ses_abc123",
    userId: "usr_abc123",
    method: "password",
    ipAddress: "203.0.113.42",
    userAgent: "Chrome 120",
  },
}

WebhookList

interface WebhookList {
  webhooks: Webhook[];
  nextPageToken: string | null;
  totalSize: number;
}

DeliveryList

interface DeliveryList {
  deliveries: WebhookDelivery[];
  nextPageToken: string | null;
  totalSize: number;
}

See also

On this page