Skip to content

End-to-end booking lifecycle

This is the chronological timeline of every guest-facing and internal event for a typical Direct booking made 30 days before arrival, with the guest opting in for both early check-in and late check-out add-ons.

Phase order

The workflow runs all phases sequentially. Each step.sleepUntil(t) waits until the target time before continuing. Workflows survive worker restarts and can sleep for days.

OrderFires atPhaseAction
1Workflow spawncohost-notifyEmail TP front desk on new TP booking
2Workflow spawnchannel-specific-setupAirbnb confirm + Booking.com PAID flag
3Workflow spawncleaning-heads-upEmail/SMS cleaner
4A −14d 15:00Zpre-arrival-T14Welcome email + 3 forms + yellow BA flag
5A −3d 15:00Zpre-arrival-T3Pre-checkin reminder + pink “late” flag (if not done)
6A −2d 15:00Zearly-checkin-availabilityBill capture/decline email
7A −1d 06:00Zarrival-flagSet booking flag pink + statusCode 11
8A −1d 15:00Zpre-arrival-T1Final pre-check-in reminder (if not done)
9A +0 14:00Zarrival-day-bill-emailTell Bill who’s arriving today
10A +0 14:00Zpre-arrival-T0Lock-box codes / arrival instructions
11A +0 21:00Zstill-dirty-checkAlert Bill if cleaning not complete by 3pm
12A +1d 15:00Zarrival-plus-1-chaseEmail guest if check-in form still unsubmitted
13D −3d 15:00Zlate-checkout-availabilityTime-picker link to guest
14D −2d 16:00Zcleaning-T2-reminderCleaner T-2 reminder
15D −1d 14:00Zcheckout-eve”Checkout tomorrow” message to guest
16D −1d 16:00Zcleaning-time-commitAsk cleaner for time-commit
17D +0 14:00Zdeparture-day-bill-emailTell Bill who’s checking out today
18D +0 (eve)departure-flagSet booking flag cyan

A = arrival date, D = departure date. UTC times. 15:00Z = 9am MT, 14:00Z = 8am MT, 21:00Z = 3pm MT, 16:00Z = 10am MT.

What runs when

  • Workflow spawn (immediate): cohost-notify, channel-specific setup, cleaning heads-up.
  • Pre-arrival window: T-14 / T-3 / T-1 / T-0 messages staggered to match the guest’s planning window. (T-5 was retired May 2026; its visual-flag role folded into T-14 and T-3.)
  • Arrival day: Bill morning email at 8am MT, lock-box codes go to guest at 8am MT, still-dirty alert at 3pm MT if cleaning incomplete.
  • Stay window: T+1 check-in form chase, then quiet until departure-eve.
  • Departure window: T-3 late-checkout picker (if opted in), T-2 cleaner reminder, T-1 checkout-eve message, T-1 cleaner time commit.
  • Departure day: Bill morning email + departure flag set in evening.

Last-minute bookings

When a booking is created within 14 days of arrival, all pre-arrival phases whose fireAt is in the past would otherwise blast immediately. A 24-hour gate prevents that: any pre-arrival message phase reads pre_checkin_submissions.last_pre_arrival_msg_at; if it’s <24h old, the phase no-ops. The next phase still runs at its scheduled time.

Same-day booking gets exactly one welcome message; the T-3/T-1 reminders skip. T-0 morning-of-arrival still fires because it bypasses the gate (critical send).

Phase idempotency

Workflows can re-spawn (via ensureBookingFlagWorkflow) on every Beds24 modify webhook. Phases must therefore be idempotent:

  • Per-recipient state in D1 (e.g., cleanings.heads_up_sent_at, pre_checkin_submissions.last_pre_arrival_msg_at)
  • Beds24 infoItems (e.g., COHOST_NOTIFIED=Y, OTA_CONFIRMED=Y, CANCEL_CLEAN_SENT=Y)

See Booking-flag workflow for the implementation pattern.