Case · AI agents
Scale: 32,000 brokers the opted-in audience it was built to reach safely.
Capability: 1 switch pauses every send; spend is capped per contact, per burst and per day.
WhatsApp qualifying agent
Qualifies leads on WhatsApp with consent and a spend cap, then hands the hot ones to a person.
The outcome
A broker network can talk to an opted-in audience of 32,000 brokers on WhatsApp without a person typing every reply. The agent explains the offer, answers questions, scores interest and hands hot leads to the right relationship manager. It stays inside Meta’s rules and inside a budget the team controls.
What I built
- A job queue, not a script. Webhooks land in Postgres; send and AI workers run every minute, with de-duplication and message-level idempotency so nothing is sent twice.
- A consent ledger that is append-only, with permanent opt-outs, the 24-hour service window enforced and approved template openers.
- Spend caps at three levels: per contact per day, per burst and a global daily ceiling, all tunable live in a Controls screen.
- Pacing to Meta’s limits. The daily send cap follows the account’s sending tier, bulk sends are chunked, and one switch pauses everything.
- An AI inbox with handoff. Relationship-manager teams get leads by round robin and see only their own conversations.
- Lead scoring on fit, intent and engagement, so the hottest leads surface first.
- Learning with a human gate. An optional loop mines chats for objections and competitor mentions, and a person approves each one before it becomes a fact the agent can use.
The hard part
- Send-budget maths. Function run time, send pace and Meta’s tier all limit how fast a large send can go. The pacing is calculated, not guessed.
- An audit before the blast. Reliability, compliance, security and go-live checks found three blockers before the first large send. All three were fixed first.
- Prompt injection. Tools are bound so inbound text can’t change what the agent is allowed to do.
- Showing it safely. A demo mode with bundled sample data means the console can be shown without a single real contact.
How it was built
AI-assisted development from a written spec and a set of guardrails I wrote first, with every change reviewed. Tests and the pre-send audit decide what goes live, and every change ships with an updated changelog.
Stack
- 2AI models: one replies, one classifies
- 24 hservice window, enforced in code
- 3-levelspend cap: contact, burst, daily ceiling
- 4-partaudit before the first large send