le-hoetel

Data and consent rules

What guest data we collect, what we never collect, how consent is logged, and who owns the data.

Not legal advice

Law 2004-63 and the INPDP apply. We are not lawyers. A lawyer checks the consent wording and hosting before the first pilot.

Ownership

  • The hotel owns the guest data. We only process it, and the contract says so.
  • Data is stored in our database, per hotel, so our AI can learn from it later.
  • We never sell or reuse a raw guest list.
  • Anonymous combined stats are ours to use.
  • The hotel can export and delete at any time, per guest and per hotel.

Data tiers

TierFields
Must haveName, phone, language, consent
OptionalBirthday, email
Optional with consentOrigin (country, city), stay dates, length of stay, where they go next, survey answers
NeverContinuous phone location, passport or ID numbers, payment cards

Every extra question lowers the number of guests who finish the form, and every field is something we must protect. Do not add a field the hotel would never use.

  • Consent is logged per channel: email, WhatsApp, and later SMS.
  • Each entry records the timestamp, the source, and the wording version.
  • The log is append only. A change of mind is a new entry, never an edit. See consent log is append only.
  • WhatsApp and email have separate toggles on the capture page, both off by default, each with the exact logged wording under it.
  • Every message carries an unsubscribe link or STOP. Messaging builds them with packages/common/src/unsubscribe.ts: signUnsubscribeToken, unsubscribePageUrl, listUnsubscribeHeaders (RFC 8058 one tap, for email) and unsubscribeFooter (the line every message ends with). The link opens /u/<token> on the web app (en, fr, ar, the hotel's branding): one switch per channel and one tap to stop everything. Each change is a consent event with source unsubscribe_link. Email clients that show their own button POST to /unsubscribe/<token> on the api.
  • An inbound WhatsApp message is checked with isStopKeyword (the whole message must be STOP, arrêt, توقف and the like). The webhook then calls applyStopReply, which withdraws WhatsApp consent with source stop_reply. See unsubscribe links are signed tokens.
  • The consent text lives in one place so it can change after legal review: packages/common/src/consent.ts (CONSENT_WORDING in en, fr and ar, and CONSENT_WORDING_VERSION, bumped on every change).
  • /privacy and /terms (en, fr, ar) are short plain-language drafts in apps/web, not yet reviewed by a lawyer; the privacy page prints the live CONSENT_WORDING, so it can never drift from what the capture page shows.

Changing the wording

  • Edit CONSENT_WORDING in packages/common/src/consent.ts only. Never copy the text into a component or a translation file.
  • Bump CONSENT_WORDING_VERSION (YYYY-MM-<label>-<n>) in the same change, for any edit, even a typo in one language. Every consent event stores the version the guest saw, so old events stay true.
  • Adding a channel or a language is also a bump. Old events are never rewritten.

The QR capture page

  • Guest pages (/h/... and /u/<token>) ship none of the site chrome and almost no client code: native radio chips, native toggles, a native <details> for the optional part. One small client component holds the form. The hero is the hotel's logo (or its initials) and name over a quiet zellige pattern in its primary color; the perk card uses its accent color. A language switcher (fr, ar, en) sits in the corner.
  • Fields: name, phone (country selector, +216 by default), message language, two consent toggles, then an "optional" section with birthday and email. The submit button is sticky on phones. Name and phone are checked on blur, so a wrong phone number rarely reaches the api.
  • Success shows at once (animated check, the perk, what to do at the front desk) while the request is sent. If the api refuses (invalid, rate limit) the form comes back with the guest's answers and an error.
  • Route apps/web/app/h/[hotelSlug]?src=room|table|desk&loc=<spot>&lang=en|fr|ar. src becomes the guest source (qr_room, qr_table, qr_front_desk), loc is stored as guests.capture_location.
  • Branding comes from hotel_settings through public.hotel, which returns only the display name, two colors, logo url, default language and slug. Everything else stays behind a session.
  • public.capture is the one public write. It is scoped by the hotel slug, always sets profile consent to false, and goes through the same upsertGuest as staff and CSV, so a known phone merges and every answer lands in the consent log with the wording version.
  • The page loads in the hotel's default language with a link switcher (no JS needed), is noindex, and skips the site chrome (feedback button, consent banner, analytics) to stay small on a weak connection.
  • Abuse protection on public.capture: 10 sign-ups per ip per 10 minutes and 200 per hotel per hour (429 over that), a hidden website honeypot, a minimum fill time of 3 seconds (renderedAt of the page render), and names that are links. A bot caught by the honeypot, the timer or a link name gets a normal "ok" and nothing is stored. Only the ip and the hotel id are used as keys, never a phone, email or name. The web app forwards the guest's x-forwarded-for so the limit is per guest, not per web server. The ip is the first hop of that header, so the api must sit behind a proxy that sets it (Dokploy, Vercel, Cloudflare do). A client that sends its own header can pick a fresh ip each time, so the per-hotel cap is the real ceiling.
  • QR codes: the dashboard page /qr-codes makes one code per room, table or front desk (hotel.qrCodes, svg, with a png download in the browser). Each code opens /h/<slug>?src=<room|table|desk>&loc=<spot>. The source is the guest's source and the spot is guests.capture_location, set when the guest is first created. hotel.captureStats counts guests per source and spot so a hotel sees which code works. Spots are not stored: a manager types them (101-120, T1, T2) and can generate the same codes again at any time.
  • Known limit: a phone number is not verified, so someone could sign up another person's number. Consent is per channel and withdrawable with STOP or the unsubscribe link.

How it is stored

  • guests is unique per hotel and phone (hotel_id, phone_e164). Every row carries hotel_id, and the consent tables point at (guest_id, hotel_id) so a row can never reference another hotel's guest.
  • guest_consents holds the current answer per guest and channel. consent_events holds every change: channel, granted or not, time, source, wording version, optional ip hash. A first "no" is logged too, an unchanged answer is not.
  • Channels are email, whatsapp and profile. profile is the consent for the optional tier (country, city, stay dates, next destination): those fields are refused without it and cleared when it is withdrawn.
  • Deleting a guest is a hard delete: the guest, its consents and its events go together, so nothing personal is left. The audit log keeps only a row without personal data: guest.delete with the SHA-256 of the guest id (hashGuestId) and the hotel id. Earlier audit rows (export, consent change) keep the opaque guest id, which names nobody once the guest row is gone. See guest delete is a hard delete.
  • Export and delete, per guest and per hotel, are in the dashboard under Guest data (owner and manager only, staff cannot). Export is JSON (every field and the full consent log, guests.export, guests.exportAll) or CSV (one row per guest, consent log in the last column, guests.exportCsv; cells starting with =, +, -, @ are neutralised against spreadsheet formulas). Delete all (guests.removeAll) needs the exact guest count, so a stale screen can't delete guests added since. Every export and delete writes an audit entry.

Phone numbers and duplicates

  • Phones are stored as E.164 (+21620123456). parsePhone in packages/common/src/phone.ts accepts the Tunisian local 8 digits, +216…, 00216…, other international numbers, separators and Arabic-Indic digits. Tunisian landlines (starting 3, 7, 8) are valid but can't take WhatsApp, so a WhatsApp consent is refused for them.
  • Same hotel and same phone is the same guest. A second capture (guests.create) merges into the existing guest: name, email, birthday, country and city only fill gaps, language and stay details take the latest value.
  • Merging never downgrades consent silently. A guest scanning again can withdraw (it is logged), a "no" coming from staff or a csv import never overrides an existing "yes".

Isolation

Logging and non-production

  • Never log a phone, email or name in plain text. Use the logger redaction.
  • Previews, tests, local and staging never send real messages. Providers are log-only there.
  • Seeds, previews and tests use fake data only, never real guests.

Parked: location tracking

Dawarich or any location tracking is parked. If it ever returns it is opt in, one time, on guest request, and only after a legal check.

On this page