Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/cal-com

src/create-booking.js

20 lines · 1.1 KB · JavaScript
import { createBooking } from './cal-com.js'

/**
 * Create a Cal.com booking for an event type and attendee.
 * Requires `dryRun: true` to preview or `confirm: true` to write.
 * @param {Object} input
 * @param {number|string} input.eventTypeId Event type to book.
 * @param {string} input.start UTC ISO start time.
 * @param {{ name: string, email: string, timeZone?: string }} input.attendee Attendee details.
 * @param {boolean} [input.dryRun] Return the request preview without creating a booking.
 * @param {boolean} [input.confirm] Required for the live write.
 * @returns {Promise<Record<string, unknown>>} Created booking payload or dry-run preview.
 * @example
 * import createBooking from 'kody:@kody/cal-com/create-booking'
 * const preview = await createBooking({ eventTypeId: 123, start: '2026-06-01T16:00:00Z', attendee: { name: 'Ada', email: 'ada@example.com' }, dryRun: true })
 * // => { dryRun: true, method: 'POST', path: '/v2/bookings', body: { ... } }
 */
export default async function createBookingEntrypoint(input = {}) {
	return await createBooking(input)
}