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:
- Send thanks email to the guest (if booking has email)
- Set booking flag (color + text) on Beds24
- Add a milestone info code to the booking
Per-form config
| Form | Flag color | Flag text | Info code |
|---|---|---|---|
pre_checkin | ffff56 (yellow) | Pre-check-in done | CHECKINCOM (with arrival time) |
checkin | 5fbf00 (green) | +check-in form | CHECKIN (and unitStatus=2 dirty) |
checkout | 00bf5f (darker green) | +checkout form | CHECKOUT |
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-checkinPOST handler callsrunFormBridgewithkind="pre_checkin"after writingCA_PRE_CHECKIN_COMPL=Y/forms/checkinPOST handler callsrunFormBridgewithkind="checkin"after persisting the submission/forms/checkoutPOST handler callsrunFormBridgewithkind="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 AA | Our 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.