Skip to main content
import { Luma } from "@alhwyn/luma";

const luma = new Luma(process.env.LUMA_API_KEY!);

const endpoint = await luma.webhooks.create({
  url: "https://myapp.com/api/luma-webhook",
  event_types: ["guest.updated", "guest.registered"],
});

// Save endpoint.secret as LUMA_WEBHOOK_SECRET
{
  "api_id": "whk-abc123",
  "url": "https://myapp.com/api/luma-webhook",
  "event_types": ["guest.updated", "guest.registered"],
  "secret": "whsec_..."
}
SDK luma.webhooks.create(body: WebhookCreateParams): Promise<Webhook> Registers a new webhook endpoint with Luma.
import { Luma } from "@alhwyn/luma";

const luma = new Luma(process.env.LUMA_API_KEY!);

const endpoint = await luma.webhooks.create({
  url: "https://myapp.com/api/luma-webhook",
  event_types: ["guest.updated", "guest.registered"],
});

// Save endpoint.secret as LUMA_WEBHOOK_SECRET
{
  "api_id": "whk-abc123",
  "url": "https://myapp.com/api/luma-webhook",
  "event_types": ["guest.updated", "guest.registered"],
  "secret": "whsec_..."
}

Parameters

body
WebhookCreateParams
required
Endpoint URL and event types to subscribe to. See the official Luma API docs for available fields.event_types also reads from LUMA_WEBHOOK_EVENT_TYPES via webhookEventTypesFromEnv().

Test it

const endpoint = await luma.webhooks.create({
  url: "https://myapp.com/api/luma-webhook",
  event_types: ["guest.updated"],
});
console.log("Endpoint ID:", endpoint.api_id);
console.log("Save secret:", endpoint.secret);