Skip to content

Form bridges (P5.M8)

Each of the three guest forms (/forms/pre-checkin, /forms/checkin, /forms/checkout) triggers a “bridge” action on submit that ports BA auto-actions 287047, 287706, and 288621.

Implementation: src/lib/form-bridge.ts. Gated by form-bridges feature flag (currently shadow_mode=0, live).

What the bridge does

For each form kind, the bridge does three things in order:

  1. Send thanks email to the guest (if booking has email)
  2. Set booking flag (color + text) on Beds24
  3. Add a milestone info code to the booking

Per-form config

FormFlag colorFlag textInfo code
pre_checkinffff56 (yellow)Pre-check-in doneCHECKINCOM (with arrival time)
checkin5fbf00 (green)+check-in formCHECKIN (and unitStatus=2 dirty)
checkout00bf5f (darker green)+checkout formCHECKOUT

The checkin bridge also sets unitStatus=2 (dirty) on the Beds24 booking — ports BA AA 287383 (“CHECKIN to dirty”).

Email bodies (excerpts)

Pre-check-in thanks:

Thanks for completing the pre-check-in for {Property}! We’ve got everything we need. On the morning of your arrival you’ll get a message with the lock box codes…

Check-in thanks:

Thanks for letting us know you’re in safely at {Property}. If anything comes up during your stay, just reply or text 952-451-8482.

Check-out thanks:

Thanks for completing the checkout form for {Property} and for staying with us! If you have a minute, a review on the channel you booked through would mean a lot.

When the bridge fires

  • /forms/pre-checkin POST handler calls runFormBridge with kind="pre_checkin" after writing CA_PRE_CHECKIN_COMPL=Y
  • /forms/checkin POST handler calls runFormBridge with kind="checkin" after persisting the submission
  • /forms/checkout POST handler calls runFormBridge with kind="checkout" after persisting

All wrapped in try/catch — if a bridge action fails (Mailgun down, Beds24 hiccup), the form’s primary D1 write still succeeded.

BA AA mapping

BA AAOur bridge
287047 (pre-checkin complete)pre_checkin bridge
287706 (CheckInForm → CHECKIN)checkin bridge
287383 (CHECKIN → unit_status=dirty)folded into checkin bridge
288621 (CheckOutForm → CHECKOUT)checkout bridge

Shadow mode

If feature_flags.form-bridges.shadow_mode=1, runFormBridge logs bridge.{kind}.shadow to migration_log and returns without sending. Lets us validate the form persistence path before flipping live.