← Public packages
@kentcdodds/cal-com
Cal.com helpers for booking pages, event types, slots, and webhooks.
src/create-webhook.js
19 lines · 961 B · JavaScriptimport { createWebhook } from './cal-com.js'
/**
* Create a Cal.com webhook subscription.
* @param {Object} input
* @param {string} input.subscriberUrl Callback URL Cal.com should POST to.
* @param {string|string[]} input.triggers Official Cal.com webhook triggers
* (e.g. BOOKING_CREATED). Kebab-case, dotted, and lowercase aliases are
* canonicalized; unofficial names are rejected locally.
* @param {boolean} [input.active=true] Whether the webhook is active. Defaults to true.
* @returns {Promise<Record<string, unknown>>} Created webhook payload.
* @example
* import createWebhook from 'kody:@kentcdodds/cal-com/create-webhook'
* const result = await createWebhook({ subscriberUrl: 'https://example.com/hooks/cal', triggers: ['BOOKING_CREATED'], active: true })
* // => { id: 1, subscriberUrl: 'https://...', active: true, ... }
*/
export default async function createWebhookEntrypoint(input = {}) {
return await createWebhook(input)
}