All projectsCase study

BookDirect: direct hotel bookings, held by the hotel's own calendar.

A booking platform for independent hotels. Guests pick dates and a room on the hotel's own page and pay there. The room is held in the hotel's Google Calendar while they pay, the hotel is paid out to its bank account, and questions are answered on WhatsApp by a bot that steps aside when staff reply.

BookDirect: direct bookings, held by the hotel's own calendar

The Problem

A small hotel that sells through the big booking platforms gives up a slice of every stay. Selling direct is cheaper, but it needs three things a boutique resort rarely has: a booking page that knows which rooms are free, a way to take money and pass it on, and someone to answer “what time is check-in?” at eleven at night.

The client wanted a product that gives a hotel all three without asking it to adopt new software. The first hotel was a boutique island resort in Malaysia, and the system had to be built so the second hotel would be a new row of settings, with no new code.

The calendar is the inventory

The original plan was to connect a channel manager, the kind of system large hotels use to sync rooms across platforms. The client's call was that this was too much machinery for a first version, and he was right: the hotel already kept its bookings in Google Calendar. So the calendar became the single record of which rooms are free.

BookDirect architecture: a React booking page and WhatsApp on the guest side, 14 Supabase edge functions with Postgres in the middle, and Google Calendar, Billplz and Chatwoot as systems of record

The hotel owner signs in with Google once and picks a calendar. From then on every booking is an event on it, tagged with the room type and the booking it belongs to. Availability is a count of the events that overlap the guest's dates, compared with how many units of that room the hotel has. There is no second copy of the inventory to drift out of step, and staff can see every booking in the tool they already open each morning.

There is no booking server either. Each rule is a small Supabase edge function, and the database decides who can read what: a hotel's staff see their own hotel's rows and nobody else's.

Hold, pay, confirm

Two guests wanting the last room on the same night is the case the whole design is built around.

BookDirect booking lifecycle: check availability, hold, bill, guest pays, webhook, confirm, split, payout

When a guest commits to a room, the system checks availability a second time and writes a tentative event to the calendar, which takes the room off sale for five minutes. Creating the payment bill stretches that to ten. If the payment arrives, the tentative event becomes a confirmed one. If it never arrives, a job that runs every minute marks the booking expired and deletes the event, and the room is bookable again without anyone touching it.

Money follows the same path. Billplz collects from the guest, its callback is checked against a signature before anything is trusted, and confirmation records a 5% commission and the amount owed to the hotel. The payout to the hotel's bank is a separate step with its own row, and the database allows one payout per booking, so a callback that arrives twice cannot pay a hotel twice.

WhatsApp, with a person behind the bot

Guests in Malaysia ask their questions on WhatsApp, so the hotel needed to be there. Messages come in on the official WhatsApp Cloud API and are passed into a shared inbox, where a bot answers from the hotel's own facts. When a staff member replies, the bot goes quiet for that conversation.

BookDirect WhatsApp bridge: message in, shared inbox, answer by bot or person, reply out, guest's phone
The FAQ agent and the inbox were set up by a collaborator on the client's team. The bridge that carries messages in both directions is my work.

The reply that goes back to the guest does one more job. Any link to the booking page is signed on its way out. Opened without that signature, the page shows the public rate. Opened from the WhatsApp link, it shows the hotel's direct rate and already knows the guest's number, so the discount is a reward for talking to the hotel directly and the guest does not have to type their phone in again.

Inside the product

BookDirect hotel page on desktop with the price card and the room list
The hotel's page. The brand a guest sees is the hotel's; BookDirect stays in the background. The hotel's name, description and photos are blurred throughout this case study.
BookDirect room selection on desktop with three room types and prices for the chosen dates
Room choice for the selected dates. Rooms with no free units on those nights drop out of this list.
BookDirect hotel page on a phone
BookDirect price details sheet on a phone
BookDirect room selection on a phone

The product is WhatsApp-first, so the phone layout came first and the desktop pages were built on top of it.

Hotel staff have their own side: a dashboard where they edit room descriptions, photos and nightly rates, invite colleagues by email, and enter the bank details their payouts go to. The owner connects the calendar; staff can change content but not where the money goes.

Problems worth writing down

We built booking inside the chat, then shelved it

The first WhatsApp version took the whole booking in conversation: a state machine of about 650 lines that asked for dates, guests and a room, with a language model reading free-text answers into a fixed structure. In testing it reached a held room and a payment bill. Then the client decided bookings should finish on the web page and WhatsApp should answer questions and hand out links. Because holding, billing and confirming already lived in functions that both the page and the chat called, the change was a matter of rerouting messages, and nothing about bookings had to be rebuilt.

New API keys broke every call between functions

The Supabase project was moved to the newer key format partway through. The booking page kept working, but any function that called another protected function started failing with an 'invalid JWT format' error, because the new keys are not tokens the gateway accepts. The final confirm step in WhatsApp was the first place it showed. The fix was a dedicated internal credential for function-to-function calls, and a note to audit every such call before the old format is switched off.

A payment that arrived after the hold expired

A test payment left the return page waiting forever. The chain was healthy: the bill had been created during an earlier check, its ten minutes ran out, the sweep released the room, and the payment landed afterwards and was correctly refused. It exposed a real gap, though. A guest who pays late loses the room after the money has moved. I flagged it as the first thing to settle before live payments, with the options written down: re-create the event if the room is still free, or refund.

Connecting a WhatsApp number takes two steps, and the dashboard shows one

Ticking the 'messages' field in the Meta app settings only declares interest in that kind of event. Nothing arrives until the business account itself is subscribed to the app with a separate API call. The webhook passed its verification handshake and then stayed silent, which looks exactly like a broken webhook.

A settings call that succeeded and changed nothing

Setting up email for staff invitations, the request to save the mail server settings returned success and the settings stayed empty. The port had been sent as a number; the API wanted it as text and ignored the whole update without an error. A success response is not proof of a change, so I read the value back after writing it.

Engineering decisions

  • The hotel's Google Calendar as the only inventory, so there is no sync to break
  • Availability checked twice: once to show rooms, again at the moment of holding
  • A hold is a real tentative calendar event, visible to staff, that removes itself if unpaid
  • Four booking states instead of the eleven in the first design
  • One payout per booking and one row per WhatsApp message ID, enforced by the database
  • Payment and WhatsApp callbacks verified by signature before any state changes
  • Signed, stateless links from WhatsApp that unlock the direct rate without a login
  • Hotel data separated by row-level rules, with payout settings limited to the owner
  • Booking logic kept in functions shared by the page and the chat, which made the WhatsApp pivot cheap

Where it landed

14 Edge functions4 Booking states5 min Hold before payment0 Copies of the inventory to sync

I built this between April and June 2026 for the product's first hotel. What this page describes was checked against the deployed system: bookings held and confirmed on a real calendar, payments run through Billplz's sandbox, and a real WhatsApp number answering and handing over to a person.

The client's own team has kept building on that foundation since, so the product that is live today does more than this page covers. The screenshots are of the booking pages as they stand now.

Tech Stack

React 18ViteTailwind CSSSupabasePostgreSQLRow Level SecurityEdge Functions (Deno)pg_cronGoogle Calendar APIGoogle OAuthBillplzWhatsApp Cloud APIChatwootOpenAIResendDigitalOcean App Platform
Your turn

Need something like this? Let's talk it through.