All projects

Case study · Cabify Spain · Mar to Aug 2026

WhatsApp Ride-Booking AI Agent

People at a stadium, a concert or a station who do not have the app can still get a car: scan a QR code, chat on WhatsApp, get a price and confirm. Behind it is a Claude agent in n8n that runs the conversation, and a set of deterministic workflows that book, track, invoice and escalate.

First fully automated riden8n automation
WhatsApp Cloud APIWhatsApp Cloud APIMetaMetan8nn8nClaudeClaudeRedisRedisGoogle Maps PlatformGoogle Maps PlatformZendeskZendesk
My roleBuilt the n8n workflows, the prompt and the tools, with a colleague on the operations side.
WhenMar to Aug 2026 · first automated ride on 14 May
Built withn8n, WhatsApp Cloud API, Claude through the company LLM gateway, Redis, Google Places and Static Maps, the public ride API, Zendesk
StatusLive since May. Volume is limited by acquisition, with a weekly funnel dashboard.
14 May
2026: first ride booked, tracked and invoiced with nobody in the loop
11
workflows, about 190 nodes
7
reply templates picked by markers, not written by the model
22k
characters of prompt, six gated phases

The rider's side

Scan a QR code, accept the terms, send an origin and a destination by text or live location, walk to a fixed pickup point, see the price and confirm. The agent creates the ride, sends driver updates as the trip progresses, delivers the invoice PDF on WhatsApp and opens a support ticket if something goes wrong.

Illustrative conversation. The real flow uses WhatsApp buttons, lists, a map image and the native location request.
1 · Consentwelcome and terms,nothing else untilaccepted2 · Collectorigin and destination,text or live location3 · Validateresolve and snap to thenearest pickup hub4 · Quoteprice estimate, choicekept in session5 · Bookcreate the ride, sharelink6 · Cancelfree window computed incode
The prompt is written as six phases with explicit gates. The agent can only move to the next phase when the previous one is complete, plus one emergency interrupt that can fire at any time.

How it is built

INGUARDTHINKACTANSWERFOLLOW UPWhatsApp Cloud APIQR at a venue or areturning riderGuardsblacklist, flood cap,trip limitBooking agentClaude via the companyLLM gateway, temperature0MemoryRedis session: 15 min,last 25 messagesToolspickup · quote · create· cancel · emergencyReply routera marker picks 1 of 7templatesJourney trackerpolls every 10 s,milestones, invoice,ticket
The model decides what to do next. Code decides what the message looks like and remembers where the conversation is.
  • Deterministic replies. The model does not write the WhatsApp message. It emits a marker, and a switch picks one of seven templates. That removed a whole class of formatting errors, and it means buttons always work.
  • State outside the model. A 15-minute Redis session keeps the last 25 messages, and a data table logs every conversation.
  • Addresses. One tool decides between a places search and reverse geocoding depending on what the rider sent, ranks the candidates and snaps to the nearest allowed pickup hub, then stores it in the session.
  • Rules in code, not in the prompt. The free cancellation window, the trip limit per user, the blacklist and the daily message cap per number are enforced before or after the model, never by asking it nicely.
  • After the booking. A tracker polls the ride every 10 seconds, sends a message at each milestone and asks the rider when something looks wrong. The invoice is read from the mailbox and sent as a PDF.
MarkerWhat the rider gets
WelcomeTerms with accept and read buttons
Free textA normal chat reply
PriceQuote with confirm and change buttons
Free cancellationInside the 120-second window
Exceptional cancellationOutside the window, explains the conditions
HelpHands over to support with the conversation
Ask for locationWhatsApp's native location request
n8n · WhatsApp booking agent · 51 nodes
n8n diagram of the WhatsApp agent workflow
Main workflow: message type switch and guards on the left, the agent with its memory and tools in the middle, the reply router on the right.
n8n · resolve pickup
n8n diagram of the pickup resolution tool
Tool: resolve the pickup and snap it to a hub.
n8n · journey tracker
n8n diagram of the journey tracker
Journey tracker: status polling, milestones, invoice and ticket.

Results, and what limits them

The system worked end to end from May: on 14 May it took the company's first ride booked, tracked and invoiced with nobody in the loop. A first stadium pilot turned 25 conversations into 5 completed rides over four days. A B2B variant lets corporate accounts ask for immediate rides the same way.

Volume stayed small afterwards because the QR codes were handed out manually. The bottleneck is getting the code in front of people, not the agent, so that is where the next iteration starts. A weekly dashboard, rebuilt by a Claude skill, tracks the funnel from scan to ride.

What I learned

  • Letting the model choose the next step and code choose the message was the single change that made it reliable.
  • Guards are cheap, and they belong in the first release rather than after the first abuse.

Numbers, venue names and account details are left out on purpose. The conversation above is illustrative.