Inquiries & Reports
Inquiries are pre-booking questions sent to a supplier without exposing either party's email address. A tokenized relay address handles the whole back-and-forth, and a Turnstile gate keeps the anonymous mail-sending endpoints from becoming a spam cannon.
Endpoints
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| POST | /inquiry | Turnstile trip_inquiry | Send a booking enquiry |
| POST | /report | Turnstile problem_report | Send a site problem report |
| POST | /supplier/public/:id/contact | Turnstile supplier_contact | Reveal supplier contact details |
| POST | /resend/received | Svix signature | Resend email.received webhook for the relay |
Creating an enquiry
POST /api/v1/inquiry
Content-Type: application/json
{
"activityId": "V1StGXR8_Z5jdHi6B-myT",
"travelerName": "Ada Lovelace",
"travelerEmail": "ada@example.com",
"message": "Do you run this trek in December?",
"travelers": 2,
"startDate": "2026-12-10",
"endDate": "2026-12-18",
"token": "<turnstile-token>"
}| Field | Rule |
|---|---|
activityId | Required |
travelerName | 2–120 characters, trimmed |
travelerEmail | Valid email, max 254 characters |
message | 10–4000 characters, trimmed |
travelers | Integer 1–50, defaults to 1 |
startDate / endDate | Optional YYYY-MM-DD; stored as date-only at midnight UTC |
token | Required Turnstile token, max 2048 characters |
Success returns 201 with the inquiry id as data.reference:
{
"message": "Enquiry sent. The supplier will reply by email.",
"data": { "reference": "V1StGXR8_Z5jdHi6B-myT" }
}Failure modes:
| Status | Cause |
|---|---|
400 | Zod validation failed |
403 | Turnstile verification failed |
404 | Activity is not published + approved, or its supplier is suspended |
502 | The inquiry row was created but the supplier email failed |
503 | FRONTEND_BASE_URL or INQUIRY_RELAY_DOMAIN is not configured |
The row is created before the email because the reply address is derived from the row id. If the send fails, the row stays; a later retry can reuse the same relay address.
Only public activities
An inquiry lookup requires published = true and status = APPROVED, plus a supplier that is not suspended. A hidden or rejected activity cannot be used to reach a supplier's inbox.
The relay
Both the first email and every reply use the same reply-to address:
inquiry-<inquiryId>@<INQUIRY_RELAY_DOMAIN>The supplier never sees the traveller's address, and the traveller never sees the supplier's. The Inquiry row is the only mapping.
Traveller ──POST /inquiry──▶ API ──email──▶ Supplier
▲ │
│ reply to relay
│ ▼
└──── relayed reply ◀── POST /resend/received ── ResendReceiving replies
Resend posts email.received events to POST /api/v1/resend/received. The endpoint:
- Verifies the Svix signature against
RESEND_WEBHOOK_SECRETusing the raw body. Re-serialising parsed JSON changes the bytes and breaks the signature. - Ignores every event type other than
email.received, returning200so Resend does not retry work that was skipped deliberately. - Extracts the inquiry id from the
toaddress. The local part must start withinquiry-and the id must be exactly 21 nanoid characters. - Compares the sender against the traveller and supplier emails on the row. Direction is decided by that comparison, never by anything else in the address.
- Fetches the received email, keeps only the newest plain-text message (quoted history is stripped), truncates to 4000 characters, and sends a new email to the other party.
Bad input is acknowledged with 200; a transient relay failure returns 500 so Resend retries. A non-participant sender is dropped and never forwarded.
Why not auto-forward?
Resend's forward helper preserves the original headers, including the traveller's real address. The relay composes a fresh message instead, which is what keeps both addresses private.
Relay requirements
| Variable | Purpose |
|---|---|
INQUIRY_RELAY_DOMAIN | Subdomain with Resend receiving enabled, e.g. relay.myeasyguide.com |
RESEND_WEBHOOK_SECRET | Svix signing secret for the email.received webhook |
FRONTEND_BASE_URL | Base for activity links in both emails |
Inbound DNS must point the relay subdomain at Resend's inbound MX (inbound-smtp.<region>.amazonaws.com); the apex mail host is untouched.
Inquiry record
model Inquiry {
id String @id @default(dbgenerated("nanoid(21)"))
activityId String
supplierId String
travelerName String
travelerEmail String
message String
travelers Int @default(1)
startDate DateTime?
endDate DateTime?
status InquiryStatus @default(OPEN)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}InquiryStatus is OPEN or CLOSED. Rows are created OPEN; there is no public or supplier endpoint that changes the status, so closing is currently an out-of-band operation. There is also no inbox endpoint — the conversation lives in email.
Problem reports
POST /api/v1/report
Content-Type: application/json
{
"name": "Ada",
"email": "ada@example.com",
"message": "The booking calendar shows the wrong month.",
"pageUrl": "https://myeasyguide.com/activities/...",
"token": "<turnstile-token>"
}name and pageUrl are optional; email, message (10–4000 characters) and token are required. The report is emailed to PROBLEM_REPORT_TO with the reporter's address as replyTo and the request's user agent attached. Success returns 201; a failed send returns 502.
Turnstile
All three public write endpoints call verifyTurnstile(token, action, ip). A token is accepted only when all of these hold:
- The Siteverify response is
success: true. - The response
actionmatches the expected action for that endpoint. - The response
hostnameis in the comma-separatedTURNSTILE_HOSTNAMESallowlist.
Local development fails closed
Localhost is deliberately absent from the production allowlist, so these endpoints always return 403 in development unless you add a localhost entry and a matching test secret/key pair. This is intentional: a captcha that passes everywhere is not a captcha.