WhatsApp Commerce V2 · reference implementation
A production-oriented reference implementation of WhatsApp Catalog + Cart ordering, on Rails 8, PostgreSQL and the WhatsApp Cloud API, verified against real Meta traffic.
Read the case study Source on GitHub Public menu
The Local Table is a fictional restaurant; its menu is seed data.
Version one took real orders in August 2026. Its own logs showed what the demo hid: all 36 delivery-status webhooks were discarded, 7 errors were answered with HTTP 200 and kept only in a log line, and not one outbound message had a Meta message id.
Version two was rebuilt around those problems. Webhooks are stored before they are interpreted, effects are made idempotent, every outbound message has an explicit state, and failures are visible to an operator.
Each webhook is signature-checked and stored with its background job in one database transaction, then acknowledged. The work happens afterwards.
Each item is keyed by its Meta message id, so a duplicate delivery changes nothing, and stored deliveries can be replayed safely.
Replies go through an outbox and only move forward: sent, delivered, read. A send with an unknown outcome is never resent automatically.
Meta's error code and details are stored on the message and classified as retryable, permanent, configuration or ambiguous.
Every line keeps the price the customer saw and is compared with the catalog; mismatches and unknown items are flagged for review.
Orders, conversations, deliveries with safe replay, and a health page for failures, unknown outcomes and blocked messages.
Not a mock: the deployed app ran against Meta's real WhatsApp Cloud API, with the author as the only customer.
131009 on the first catalog card, diagnosed from Meta's stored details: the catalog was switched off in the new number's commerce settings. Fixed by hand in Meta; the next message worked.
A production-oriented reference implementation, not a claim of production-scale operation: one test customer (the author), no uptime or volume figures, and a planned multi-week operating period that was not pursued. Catalog API push and the 24-hour window block were not verified against Meta.