Skip to content

Channel routing

Defined in src/mailgun/client.ts as dispatchChannelFor(apiSource):

function dispatchChannelFor(apiSource: string): DeliveryChannel {
const normalized = apiSource.toLowerCase();
if (normalized === "airbnb" || normalized === "bookingcom") {
return "ota_message";
}
return "email";
}

Returns either "ota_message" (use Beds24 thread which routes to OTA chat) or "email" (send via Mailgun).

Per-channel behavior

ChannelEmailBeds24 thread
Direct✅ if booking.email present⚠️ context-dependent
VRBO✅ if booking.email present⚠️ context-dependent
Airbnb✅ if real email✅ (routes to Airbnb chat)
Booking.com✅ if real email✅ (routes to BookingCom chat)

Phases that use channel routing

PhaseEmailThread
T-14 / T-3 / T-1 pre-arrivalalways (if email)only for OTA
T-0 morning-of-arrivalalways (if email)only for OTA
Checkout-evealways (if email)always (host-side record)
Add-on confirmations (M4e)always (if email)always
Airbnb confirm (M10)yes (if email)yes (primary path for OTA)

Why thread for OTA

OTA guests typically book under a relay email (e.g., +abc123@guest.airbnbmail.com) that the OTA forwards to the guest’s real inbox. Sending direct to the relay email works but isn’t ideal — the OTA chat is the canonical thread.

Beds24’s /bookings/messages endpoint handles the OTA-side relay automatically: when we POST a message with source=host and the booking is an Airbnb/Booking.com one, Beds24 forwards into the OTA messaging system.

SMS

Twilio SMS via Mailgun is only used for:

  • Cleaner notifications (heads-up, T-2, time-commit)
  • Guest add-on confirmations (M4e) — only if booking.phone looks real
  • Internal Bill alerts (bounces, watchdog, Twilio failures)

We don’t send guest pre-arrival SMS by default — BA’s AAs that did that were no-ops anyway (smsenable=0 across the board).

Source

  • src/mailgun/client.tsdispatchChannelFor
  • src/workflows/pre-arrival-messages.ts — uses dispatchChannelFor
  • src/workflows/channel-specific.tsrunAirbnbConfirm, runBookingComPaidFlag
  • Channel-specific behaviors documented in Airbnb, Booking.com, VRBO, Direct