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
{
"template": "booking_confirmed_guest",
"booking_uuid": "{booking_uuid}"
}Templates (lodging v1)
| template | To | When |
|---|---|---|
booking_pending_guest | Guest | Booking created |
booking_confirmed_guest | Guest | Payment confirmed |
booking_confirmed_owner | Property owner | Payment confirmed |
booking_cancelled_guest | Guest | Cancel / refund |
booking_cancelled_owner | Owner | Cancel / 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}
{
"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.