Skip to content

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 ​

MethodEndpointAuthPurpose
POST/inquiryTurnstile trip_inquirySend a booking enquiry
POST/reportTurnstile problem_reportSend a site problem report
POST/supplier/public/:id/contactTurnstile supplier_contactReveal supplier contact details
POST/resend/receivedSvix signatureResend email.received webhook for the relay

Creating an enquiry ​

http
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>"
}
FieldRule
activityIdRequired
travelerName2–120 characters, trimmed
travelerEmailValid email, max 254 characters
message10–4000 characters, trimmed
travelersInteger 1–50, defaults to 1
startDate / endDateOptional YYYY-MM-DD; stored as date-only at midnight UTC
tokenRequired Turnstile token, max 2048 characters

Success returns 201 with the inquiry id as data.reference:

json
{
  "message": "Enquiry sent. The supplier will reply by email.",
  "data": { "reference": "V1StGXR8_Z5jdHi6B-myT" }
}

Failure modes:

StatusCause
400Zod validation failed
403Turnstile verification failed
404Activity is not published + approved, or its supplier is suspended
502The inquiry row was created but the supplier email failed
503FRONTEND_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:

text
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.

text
Traveller ──POST /inquiry──▶ API ──email──▶ Supplier
    ▲                                         │
    │                                  reply to relay
    │                                         ▼
    └──── relayed reply ◀── POST /resend/received ── Resend

Receiving replies ​

Resend posts email.received events to POST /api/v1/resend/received. The endpoint:

  1. Verifies the Svix signature against RESEND_WEBHOOK_SECRET using the raw body. Re-serialising parsed JSON changes the bytes and breaks the signature.
  2. Ignores every event type other than email.received, returning 200 so Resend does not retry work that was skipped deliberately.
  3. Extracts the inquiry id from the to address. The local part must start with inquiry- and the id must be exactly 21 nanoid characters.
  4. 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.
  5. 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 ​

VariablePurpose
INQUIRY_RELAY_DOMAINSubdomain with Resend receiving enabled, e.g. relay.myeasyguide.com
RESEND_WEBHOOK_SECRETSvix signing secret for the email.received webhook
FRONTEND_BASE_URLBase 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 ​

prisma
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 ​

http
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 action matches the expected action for that endpoint.
  • The response hostname is in the comma-separated TURNSTILE_HOSTNAMES allowlist.

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.

Built with VitePress