Notifications & Email
The Booking Kit includes email templates and notification job helpers for the booking lifecycle.
Email functions
Section titled “Email functions”import { sendConfirmationEmail, sendReminderEmail, sendCancellationEmail, sendRescheduleEmail,} from "@thebookingkit/core";
// Each function takes a payload and an EmailAdapterawait sendConfirmationEmail( { bookingId: "...", customerName: "Alice", customerEmail: "alice@example.com", eventTitle: "30-Min Consultation", startsAt: new Date("2026-03-10T14:00:00Z"), endsAt: new Date("2026-03-10T14:30:00Z"), timezone: "America/New_York", providerName: "Dr. Smith", location: "123 Main St", }, emailAdapter,);Built-in templates
Section titled “Built-in templates”| Template | When sent |
|---|---|
CONFIRMATION_EMAIL_HTML/TEXT | After booking is confirmed |
REMINDER_EMAIL_HTML | Before appointment (configurable hours) |
CANCELLATION_EMAIL_HTML | When booking is cancelled |
RESCHEDULE_EMAIL_HTML | When booking is rescheduled |
Template interpolation
Section titled “Template interpolation”import { interpolateTemplate } from "@thebookingkit/core";
const html = interpolateTemplate(CONFIRMATION_EMAIL_HTML, { customerName: "Alice", eventTitle: "Consultation", date: "March 10, 2026", time: "2:00 PM", providerName: "Dr. Smith", // ...});Calendar sync
Section titled “Calendar sync”import { syncBookingToCalendar, deleteBookingFromCalendar } from "@thebookingkit/core";
// Create a calendar event for a bookingawait syncBookingToCalendar(bookingPayload, calendarAdapter);
// Remove calendar event on cancellationawait deleteBookingFromCalendar(deletePayload, calendarAdapter);ICS attachments
Section titled “ICS attachments”import { generateICSAttachment } from "@thebookingkit/core";
const ics = generateICSAttachment({ title: "Consultation with Dr. Smith", start: new Date("2026-03-10T14:00:00Z"), end: new Date("2026-03-10T14:30:00Z"), location: "123 Main St",});// Returns an ICS file string for email attachmentFormatting helpers
Section titled “Formatting helpers”import { formatDateTimeForEmail, formatDurationForEmail } from "@thebookingkit/core";
formatDateTimeForEmail(new Date("2026-03-10T14:00:00Z"), "America/New_York");// "Tuesday, March 10, 2026 at 9:00 AM EST"
formatDurationForEmail(30); // "30 minutes"formatDurationForEmail(90); // "1 hour 30 minutes"