AI agent · Sales
An AI sales agent that answers every lead on WhatsApp
A language school was losing leads because one teacher could not reply to everyone by hand. I built an agent that runs the whole conversation, from the first message to a confirmed enrollment.
Animated recreation
The problem
Every lead arrived on WhatsApp and every reply was manual. Messages piled up during classes, leads went cold, and nobody could tell which conversations had been answered.
What I built
- Gatekeeper plus specialist architecture: one entry point reads the context and routes the conversation. The state of each lead (flow, course, shift) lives in the database.
- Human timing: the message is marked as read after about 25 seconds and the reply goes out around 40. Split messages are grouped by a debounce, and the typing indicator lasts in proportion to the answer.
- Confirmed human handoff: the agent flags the chat and alerts the teacher. A "return to agent" button in the admin panel gives control back.
- Stripe payment becomes an enrollment automatically, idempotent by checkout session, so a resent webhook never enrolls anyone twice.
- Six satellite workflows: re-engagement, one follow-up after 24 hours, waitlist notice, unanswered lead watcher, payment double-check every 20 minutes and a paced drip for broadcasts.
- Class reminders: scheduled workflows post the meeting link in each class group 10 minutes before start, on Dublin time with daylight saving handled.
Architecture
- 01
WhatsApp Cloud API
Inbound message webhook
- 02
Normalize and match
Phone format, lead record, open classes
- 03
Build context
History, course, payment status
- 04
gpt-4o decides
Reply, handoff, waitlist or payment link
- 05
Send and log
Human timing, every message stored
Runs alongside
- Stripe webhook turns payment into enrollment
- 6 scheduled satellite workflows
- Admin panel with human handoff
The hard lesson
Accepted is not delivered. The WhatsApp Cloud API returns a message ID even for messages it later drops, for example free text sent outside the 24 hour window. The logs looked green while some leads never got the reply. I added delivery tracking from the status webhooks and a rule in the agent: outside the window it only sends approved templates. Now every reply has a real delivery status, not just an accepted one.
Results
- nodes in the main workflow
- 53nodes in the main workflow
- real conversations distilled into the sales knowledge base
- 87real conversations distilled into the sales knowledge base
- real messages and 123 lead records audited
- 341real messages and 123 lead records audited
- funnel leaks found and documented
- 9funnel leaks found and documented
Stack
- n8n
- OpenAI gpt-4o
- WhatsApp Cloud API
- Supabase / Postgres
- Stripe
My role
I designed and built it end to end: conversation design, prompts, n8n workflows, database schema, Stripe integration and the controls in the admin panel. I also audited the real conversations to find where the funnel was leaking.
Why there is no public access
The agent talks to real people. Its conversations hold names, phone numbers and payment status of real leads, so there is no public demo. The chat in the animation above is fictional.
I can show it running live on a call.
I open the real system, with personal data protected, and answer anything you want to know about how it is built.
mirandamauro93@gmail.com