WhatsApp and chat
How a WhatsApp message moves through Neo
How Neo receives a message, keeps it safe, understands it, and sends a reply.
Inbound receipt
Meta verification uses the configured verification token. Message callbacks require the provider signature. The adapter parses a normalized event, redacts sensitive invite or identity text, and commits a durable inbox envelope before acknowledging Meta.
sequenceDiagram participant M as Meta participant A as API participant Q as inbox_events participant W as Worker participant C as Conversation M->>A: Signed webhook A->>A: Verify, parse, redact A->>Q: Durable receipt A-->>M: 200 W->>Q: Ordered claim W->>C: Process one conversation turn C->>Q: State, decision, and outbox
If the diagram does not render, its Mermaid source remains readable above.
Session identity and ordering
A WhatsApp session is unique by channel and canonical phone identity. The database stores state/schema versions, automation status, and the latest provider marker. PostgreSQL worker claims and advisory locks serialize one conversation. Compare-and-swap state updates reject stale writes.
Late messages are retained as read-only evidence; they cannot execute an old confirmation against newer state.
Native payload precedence
Signed native product selection, catalogue cart, Flow completion, and interactive reply payloads carry stronger transport meaning than a model guess about their text representation. They bypass irrelevant clarification and run deterministic handlers.
The default-off dynamic buyer checkout chooses one shop before products and prevents cross-shop composition. Its completion stages only the cart, quote, and pending confirmation. Native referred products and store-scoped carts remain compatibility fallbacks.
Evidence and tests
src/whatsapp.tssrc/buyer-checkout-flow.tssrc/whatsapp-flow-endpoint.tssrc/provider-runtime.tssrc/durable-queue.tssrc/meta-commerce.tstest/buyer-checkout-flow.test.tstest/whatsapp-flow-endpoint.test.tstest/whatsapp.test.tstest/provider-runtime.test.tstest/phase2-postgres-runtime.test.ts
