Skip to main content
← All notes
Building

The booking email says call or consultation depending on how long the session is

software

The booking API at /api/book sends a confirmation email after every successful calendar event creation. The language in that email adapts based on the duration parameter. A fifteen-minute booking is a call. Anything longer is a consultation. The ternary sits in the email body — duration greater than fifteen renders Your 45-minute consultation with James has been confirmed, while a default-length booking renders Your 15-minute call with James has been confirmed. The same distinction carries into the Google Calendar event title. The insert call builds the summary as a template literal — 15min Call colon name dash service label, or 45min Consultation colon name dash service label. One word changes in two places and the entire interaction feels proportional to the commitment. A fifteen-minute intro call is casual. A ninety-minute consultation is substantial. The vocabulary should match. The email subject is the same for both — Call confirmed followed by the formatted date and time. Dates use en-GB with weekday, day, month, and year. Times use twenty-four-hour format with no seconds. The email body uses an array of strings joined by newline characters, with a filter-Boolean pass to strip empty lines. The Google Meet link line is an empty string when no meet link exists, and the filter removes it so there is no blank line in the middle of the email. The skipEmail flag adds another layer. When a booking originates from the post-payment checkout flow, the caller passes skipEmail as true. The Stripe webhook has already sent a purchase confirmation, so sending a second booking email would be redundant. The calendar event still creates, the Google Calendar invite still sends, but the Resend email stays silent. One flag, one conditional, and the client gets exactly one notification per action regardless of which flow created the booking.

Comments coming soon

Sign in with TikTok to leave a comment. Coming soon.