Skip to content

Middleware — Emails

Folder: src/routes/emails/
Mount: api/v1/bookdirect/emails
Status: to implement. Use Resend (or SMTP). Render templates in Middleware — do not call Resend from the Vue app.

Middleware · winner

POST https://middleware-dev.bookdirect.live/api/v1/bookdirect/emails/send

json
{
  "template": "booking_confirmed_guest",
  "booking_uuid": "{booking_uuid}"
}

Templates (lodging v1)

templateToWhen
booking_pending_guestGuestBooking created
booking_confirmed_guestGuestPayment confirmed
booking_confirmed_ownerProperty ownerPayment confirmed
booking_cancelled_guestGuestCancel / refund
booking_cancelled_ownerOwnerCancel / refund

Load booking + property + owner email from Core, then send. After success, optional metadata on the booking:

POST https://backend-dev.bookdirect.live/public/api/v1/nellalink/meta-data/entity/booking/{booking_uuid}

json
{
  "meta_key": "email_event_guest_confirmed",
  "meta_value": "2026-09-12T15:00:00Z",
  "data_type": "string"
}

Payments and refunds folders should call this service internally after Core writes — frontend trigger is optional (resend).

IDOR

Resend only if the JWT owns the booking, owns the property, or is a service call from payments/refunds. Never accept a raw to: email plus arbitrary HTML from the client.

API-first. Middleware wins over Core when both exist.