MassageBook

Building a complex, context-aware AI booking bot.

Published 2024

Services

Product Architecture

Product Design & Prototyping

Front-end Development

Back-end Development

AI Integration

Timeline

4 months

About MassageBook

MassageBook is one of the largest massage therapy marketplaces in the U.S., used by tens of thousands of independent therapists and wellness studios. The platform makes it easy for people to find local massage services and book them online. But as the company scaled, so did the complexity of user interactions — especially on mobile, where people expect fast, frictionless booking without digging through filters or drop-downs.

The Problem

MassageBook approached us with a vision:

Create an AI-powered booking assistant that could handle full conversations with users — helping them book, cancel, or reschedule appointments in natural language.

But this wasn’t just a generic chatbot request. The assistant needed to:

  • Understand vague or partial inputs from users (like "my back hurts" or "what’s available after work?")

  • Offer real-time availability across 30,000+ businesses

  • Recommend relevant services based on intent

  • Distinguish between similar words used for locations and business names

  • Authenticate users securely and initiate payment

And it had to run in three environments:

  1. On business websites (for individual providers)

  2. Inside MassageBook's native apps

  3. On MassageBook.com for marketplace-wide queries

What made this project complex

The real challenge and where the value was created came from solving problems in three tough areas: real-time logic, ambiguity in user intent, and large-scale system integration.

Our Approach

1. Conversational flow with logic behind every step

We started by designing a flow that worked across five core booking scenarios (see visual reference).


Most users didn’t come in knowing all the details. So the bot had to:

  • Prompt for location first (always the anchor point)

  • Ask if they had a specific provider in mind or wanted suggestions

  • Then clarify service type, date, time, and staff

The system had to be able to move flexibly in this flow, not just ask the same questions in order depending on how the user phrased things.


For example:

  • “I want a massage near downtown Chicago on Tuesday around 3” → Bot would infer location, date, time

  • “When’s Sarah G. next free?” → Bot would isolate staff name and cross-reference against Sarah’s schedule

This meant tracking variables in-session across a conversation and dynamically narrowing options without re-asking.

2. Understanding messy input in real time

People don't use clean, category-aligned language. One of the core technical problems we solved was interpreting vague requests like:

  • “Back massage”

  • “Pain relief”

  • “Relaxation therapy”

  • “Not too deep but not soft either”


MassageBook had hundreds of actual service categories. For example, “Deep Tissue,” “Sports Massage,” “Trigger Point Therapy,” and “Myofascial Release” could all potentially fit what a user meant by “back massage.”


We built a custom matching algorithm trained on:

  • Category tags provided by MassageBook

  • Historical user queries and booking behaviour

  • Linguistic patterns (e.g. what users mean by “deep,” “tension,” “injury”)


This system would interpret input, find the closest match(es), and suggest or auto-select options depending on confidence level. If uncertain, the bot would politely ask a clarifying question or offer choices.

3. Real-time availability search at scale

This was probably the hardest technical piece.


We had to access and filter real-time availability data for over 30,000 businesses. Availability wasn’t just binary, it depended on:

  • Location

  • Provider schedules

  • Duration of services

  • Existing bookings

  • Type of service


MassageBook provided a set of APIs, but we still needed to build a middle layer that:

  • Made requests intelligently (with as few calls as possible)

  • Parsed the data for gaps and overlaps

  • Prioritised results based on what the user asked for (e.g. “after 5pm” meant anything between 5–9pm)

  • Dealing with missing or incomplete data


We implemented smart caching, request batching, and a queueing system to avoid rate limits and reduce latency. So when a user asked “What do you have this Thursday evening?” the bot could respond within a second or two — not ten seconds, not minutes.

4. Smart Suggestion & Ranking Logic

One of the most powerful parts of this system is how it chooses what to suggest. It doesn’t just sort by distance or time. The bot looks at several signals like provider rating, how often that service is booked, past user preferences, even cancellation rates to recommend options that feel high quality, not just “close by.” So if there’s a better option slightly further away, it gets bumped up in the results. That way, the user always gets the best fit, not just the fastest.

5. Authentication and payments

To make sure returning users could easily view or manage bookings, we set up a lightweight but secure authentication system using Twilio for SMS-based login. If the user already had a profile, the bot could then pull up past appointments and stored payment methods.


We added fallback login via password (for users who didn’t want SMS) and integrated the final step payment by redirecting to MassageBook’s existing payment gateway.


This created a seamless flow from question to confirmation in one uninterrupted conversation.

Results and Impact

The AI Booking Bot is now fully integrated across the MassageBook platform — available on individual business websites, within their mobile and desktop apps, and directly on the MassageBook.com marketplace. Since launch, it’s delivered meaningful improvements across the board:

30% reduction in customer support costs

The bot can handle the bulk of booking, rescheduling, and cancellation interactions — significantly reducing the need for manual support.

Checkout time cut from 7 minutes to under 1 minute

What used to be a slow, multi-step process is now completed in a conversational flow, reducing friction and improving the overall user experience.

Higher conversion rates across booking flows

By offering smarter matches and fewer drop-offs, the system can convert more visitors into completed bookings.

Improved vendor reach and engagement

The bot’s smart matching engine connects users with the best available providers even outside their immediate search radius, increasing visibility for vendors and improving outcomes for users.

These benefits will translate into real business value:

Lower operational overhead

Faster and more intuitive booking journeys

More revenue captured through better conversion

Happier users who don’t need to fight the interface to get what they need

This isn’t just a chatbot, it’s a deeply integrated AI assistant that understands how people talk, what they want, and how to turn that into action across a complex service marketplace.

Timeline

This project was delivered over the course of four months, covering everything from early ideation and prototyping to rigorous testing and full deployment.

Tech Specs

Frontend

  • Next.js – App directory support and server-side rendering

  • React – For building a responsive, component-based UI

  • Tailwind CSS – Utility-first styling with custom animations

  • React Hook Form – For handling conversational input and validation

  • Lucide + React Icons – Lightweight icon rendering

Backend & AI Integration

  • Custom-built agent runner – Managed through vite-node, powering the chatbot logic

  • LangChain – Used selectively to handle more abstract user queries and prompt composition

  • OpenAI API (via LangChain) – Used selectively to handle complex or vague user phrasing, fallback prompts, and natural language understanding. The bot relies on a hybrid approach: LLMs for linguistic nuance and custom-built logic for structured booking flows.

  • tRPC – For fully typesafe API communication between frontend and backend

  • Express – Lightweight server for API middleware and external integration

  • Prisma – For database access and model handling (generated on build)

  • Fuse.js – Lightweight fuzzy search used in service and location disambiguation

Data layer & logic

  • Custom matching algorithm – Trained to classify vague input (like “back pain”) into relevant categories

  • Ranking engine – Takes into account factors like provider rating, popularity, and distance to suggest optimal options (not just nearest ones)

  • Real-time availability querying – Aggregates and filters data across 30k+ vendors

  • Smart fallback handling – Ensures the bot keeps going, even if some data sources fail

Infrastructure

  • Twilio – For secure SMS-based authentication

  • SuperJSON – For serialising data across frontend/backend calls

  • Zod – For runtime type validation

  • Environment validation layer – Ensures safe deployment across staging/production

Dev Experience & Tooling

  • TypeScript – End-to-end typing for safety and dev speed

  • ESLint + Prettier + Husky – Code quality enforcement and pre-commit checks

  • Tailwind Merge – For clean and efficient class handling

  • PostCSS – For extended CSS features and builds

Built by Green Republic

Built by Green Republic

Let’s build together

Tell us about your project or reach us at

Follow us on Socials.

Let’s build together

Tell us about your project or reach us at

Follow us on Socials.

Let’s build together

Tell us about your project or reach us at

Follow us on Socials.