WhatsApp flow
Live view of the 14-component message spine. Every webhook traced end-to-end.
webhooks received
across 2 traces
93% healthy stages
off-topic / injection / rate-limit
Pipeline spine
14 components · Postgres-only state · concurrency via SELECT … FOR UPDATE
raw-body + Meta signature verification
phone E.164 → tenant_id + idempotency dedupe
active flow → keyword → Haiku 4 classifier → Sonnet 4.5
JSONB stack (depth=3, auto-cancel-on-overflow)
voice/photo/text · auto-retry-once · text fallback
Option D — fires before first voice/photo
regex → template → claude → post-validate → send → rate → tnc
Tools API + Zod schema · prompt-cached system prompt
default cap 10 · configurable per-tenant
4 lookup methods · parent_quote_id chain
Handlebars + p-queue (concurrency=2) · pre-warmed browser
logos/PDFs permanent · voice/photos 30-day lifecycle
idempotency · signature · opt-out · 24h window · block-rate · template lookup
7 jobs + scheduled_job_runs idempotency
- 1Webhook receiver
raw-body + Meta signature verification
Healthylast 4ms482 / 24h - 2Tenant router
phone E.164 → tenant_id + idempotency dedupe
Healthylast 12ms482 / 24h - 33-tier message router
active flow → keyword → Haiku 4 classifier → Sonnet 4.5
Healthylast 38ms478 / 24h - 4FSM stack engine
JSONB stack (depth=3, auto-cancel-on-overflow)
Healthylast 6ms478 / 24h - 5Input pipelines
voice/photo/text · auto-retry-once · text fallback
Healthylast 1820ms247 / 24h - 6DPDPA consent gate
Option D — fires before first voice/photo
Healthylast 8ms12 / 24h - 77-layer prompt-injection defense
regex → template → claude → post-validate → send → rate → tnc
Degradedlast 22ms478 / 24h - 8Claude extraction (Sonnet 4.5)
Tools API + Zod schema · prompt-cached system prompt
Healthylast 2840ms218 / 24h - 9Correction loop
default cap 10 · configurable per-tenant
Healthylast 12ms41 / 24h - 10Quotation revision system
4 lookup methods · parent_quote_id chain
Healthylast 14ms73 / 24h - 11PDF pipeline (Puppeteer)
Handlebars + p-queue (concurrency=2) · pre-warmed browser
Healthylast 1640ms187 / 24h - 12R2 storage layer
logos/PDFs permanent · voice/photos 30-day lifecycle
Healthylast 320ms421 / 24h - 13WhatsApp SEND middleware
idempotency · signature · opt-out · 24h window · block-rate · template lookup
Healthylast 184ms396 / 24h - 14Background jobs (node-cron)
7 jobs + scheduled_job_runs idempotency
Healthylast 8ms49 / 24h
| Timestamp | Tenant | Customer | Channel | Total ms | Outcome | |
|---|---|---|---|---|---|---|
| 21 May · 14:22 | Verma Hardware | +91 ····· 6789 | Voice | 6,840 | PDF sent | |
| 21 May · 14:08 | Patel Brothers | +91 ····· 9001 | Text | 42 | Injection blocked | |
| 21 May · 13:10 | Anita Traders | +91 ····· 1212 | Voice | 5,240 | PDF sent | |
| 21 May · 12:00 | Modi Electronics | +91 ····· 2200 | Text | 380 | Confirm pending | |
| 19 May · 22:00 | Mehta & Sons | +91 ····· 0033 | Text | 220 | Off-topic blocked | |
| 20 May · 19:30 | Kapoor Hardware | +91 ····· 1111 | Text | 18 | Rate limited |
How a message flows
Five canonical paths through the spine.
Active flow advances → Whisper transcribes → Sonnet extracts → Puppeteer renders → R2 stores → SEND delivers.
- 1→
- 2→
- 3→
- 4→
- 5→
- 8→
- 11→
- 12→
- 13
Tier-2 keyword rule fires (e.g. STATUS, HELP). No LLM call. Direct response via SEND.
- 1→
- 2→
- 3→
- 13
Tier-3a Haiku 4 classifies as off_topic. Strike counter incremented (OPS-05). No Sonnet call.
- 1→
- 2→
- 3→
- 13
Regex / template / post-validate guard fires before Claude. Logged to security_events. Tenant warned.
- 1→
- 2→
- 7→
- 13
Per-tenant block-rate or per-customer flood guard trips. No SEND call. May auto-suspend at 4%.
- 1→
- 2→
- 7