A 15-agent WhatsApp and Telegram platform for a real-estate brokerage
Enquiries are captured, qualified, routed, matched to properties and followed up by AI agents. The owner approves anything sensitive, gets a daily digest on Telegram and sees every lead in one dashboard. I designed, built and operate the whole system.
Enquiries arrived faster than people could answer them
Buyers write to the brokerage on WhatsApp and Telegram at all hours, often in Telugu written in English letters. Some enquiries went unanswered and some follow-ups slipped.
The brief: recover missed enquiries, keep a human in charge of anything sensitive, and run AI at a cost a small business can carry.
One message, five stages
- STAGE 1
Capture
WhatsApp Business API webhook with a signature check that fails closed and de-duplication; Telegram through a bot bridge.
- STAGE 2
Record
One writer service saves every write to SQLite, the source of truth. A Google Sheet is the owner's mirror, never the database.
- STAGE 3
Qualify
Rules first, then a small tool-less, memory-less extraction model turns each message into structured lead details.
- STAGE 4
Act
Routing, semantic property matching on local embeddings, six lead-risk scans and follow-ups on a written cadence.
- STAGE 5
Report
A deterministic daily digest on Telegram and an owner dashboard behind login.
The same work on 91% fewer heartbeat tokens
| Change | Effect |
|---|---|
| Heartbeat intervals set per agent; 11 agents moved to scheduled runs only; a zero-token check wakes a model only when something changed | 12.0 M → 1.0 M tokens a day |
| Extraction moved out of the full intake agent into a tool-less, memory-less extractor, with rule-based parsing first | ~38 k → ~4 k tokens a message (1,177 turns, 0 errors) |
| Cache-friendly prompts | 76–79% from cache |
| Monitoring, digests and project history written as plain code | 0 AI tokens |
| Privacy-aware fallback routing | Customer-data agents never fall back to providers that may train on prompts |
Result: ₹0 marginal API cost per lead (about ₹13 at list price). The 18 methods are written up in llm-token-economics.
A human stays in charge
- Engagement rules live in one versioned policy file: answer first, ask at most one or two questions, never state prices, legal status or RERA claims. Behaviour changes by editing the policy, not the code.
- Follow-up cadence by lead temperature, quiet hours 21:00–09:00, and leads cool automatically after four ignored messages.
- 284 WhatsApp template follow-ups in four weeks, each approved by the owner in the dashboard. A cold-lead reactivation agent was built and deliberately kept off.
- Human takeover: when staff reply from the business number, the agents step back for 24 hours.
- Owner notes on Telegram apply only when unambiguous; sensitive changes ask first, and every write returns an undo handle.
- Every dashboard route needs login, with rate limits and an audit log. No customer data is pulled to my machines; backups stay on client-owned storage.
Built to recover what would otherwise be missed
- Single writer with a bounded lock, a journal, and a spool replayed every minute when the writer is busy; hourly snapshots and an AES-256 encrypted daily backup on client-owned storage. A restore drill passed.
- A watchdog every 5 minutes with automatic rollback for the webhook sidecar, and a writer guardian that checks integrity, size and locks.
- Outage recovery re-reads WhatsApp history in idle windows, and importers are idempotent by message id. A gap check once found about 20% of inbound messages missing; a gap importer was built to close it.
What I carry into every build
Never route single-purpose model calls through a full agent.
Extraction went from about 38 k to 4 k tokens a message.
Deterministic checks first, a model only on change.
Most scheduled checks need no model at all.
Signature checks must fail closed.
A webhook that guesses can be forged.
A spreadsheet is a view, not a database.
One writer, provenance and a change log.
Built over 154 days
- 19–21 May
- Engagement policy written
- 29 May
- First commits
- 15–29 Jun
- WhatsApp live; security baseline
- 2–5 Jul
- Owner dashboard live
- 1–13 Aug
- Messaging tiers, human takeover, audit and resilience layer
- 23 Sep
- Token optimisation: heartbeat spend −91%
- 24–25 Sep
- Single-writer database, self-healing jobs; 65-chapter staff runbook in English, Hindi and Telugu
- Oct
- Operating with 15 agents deployed (heartbeat, scheduled or on demand)
Build record: 95 commits, 137 k lines added across 806 files, 129 bugs closed with root cause, 61 of 75 lessons promoted into a reusable delivery playbook. The code was written by AI coding agents from my specifications; I owned the architecture, review, testing, release and operations.
Why a dentist built this
The rules that keep a clinic safe kept this system safe: written protocols, a root cause for every incident, and a human who signs off on anything that matters. I now apply them to healthcare AI.
Figures come from the platform's own dashboards and logs, 2026, and are shared with the client's permission. The client is anonymised; no customer data, code, prompts or configuration are published. The platform is presented as delivered and operating; it is not claimed to have driven sales.