back

work/orderly/

Orderly

WhatsApp questions answered from the live catalogue, so kirana owners stop replying by hand

Solo: owner app, WhatsApp bot · 2026

ReactSupabaseClerkNode.jsBuilderBot
Orderly: WhatsApp questions answered from the live catalogue, so kirana owners stop replying by hand

Manual work before

Customers order over WhatsApp. The owner reads every message, checks price and stock, replies by hand and loses track of orders.

What it automates

  • -Price and stock replies
  • -Order tracking
  • -Payment links and confirmation (planned)

The workflow

  1. triggerA customer sends a WhatsApp message to the shop.
  2. step 1The bot answers price and stock questions from the live Supabase catalogue.
  3. step 2Owner replies typed in the app are relayed to WhatsApp through the bot.
  4. step 3Order status changes only through a state machine; money is stored in integer paise; Supabase RLS keeps each shop's data apart.
  5. step 4Planned: turn the message into a priced order, send a Razorpay payment link, and let an idempotent webhook confirm payment, log the order and notify the shop.
  6. outcomeRoutine questions are answered at any hour, and the owner sees every chat and order in one app.

status In build. Bot and owner app work; the payment-link flow is planned.

In short

  • -Crash supervisor and 45-second heartbeat, shown live in the owner app.
  • -Owner replies are relayed to WhatsApp through the bot.
  • -State-machine order flow, integer paise, Supabase row-level security.

Architecture

A Node.js WhatsApp bot under a crash supervisor, reading the shop catalogue from Supabase and reporting health to the owner app.

System designOne bot process per shop, kept alive by a supervisor. Dashed = logical link; exact transport not shown.
CUSTOMER SIDESERVER · NODE.JSSHOP SIDEchateventsrestartsshop + item lookupHTTPSSQLsign inheartbeat ·repliesCustomerWhatsApp · no app installWhatsAppQR-linked device sessionBot processBuilderBot ·whatsapp-web.jsCrash supervisorauto-restart · stops at 5crashes / 30 sSupabasePostgres · RLS · shops ·items · ordersShop ownerbrowserOwner appReact 19 + Vite · orders ·chats · inventoryClerkowner sign-in
  • user
  • external
  • service
  • guard
  • data
  • client
  • call
  • logical link
  • ← scroll →
  1. 01Buyer sends a WhatsApp message
  2. 02Bot parses the intent and looks up the live catalogue
  3. 03Order moves through a state machine in Supabase
  4. 04Owner app shows orders and bot heartbeat; owner replies are relayed back

Decisions

+ Rule-based parsing for now- Adding an LLM before the channel is reliable  Reliability of the WhatsApp channel was the bigger problem; an AI parser is the planned next step.

Failure handling

Bot process crashes

Supervisor restarts it; missed heartbeats show in the owner app.

Upstream WhatsApp library bug with @lid ids

TODO: document the workaround or current status.

Numbers

45 s

Heartbeat interval

Next

  • ○ Hinglish message → structured, priced order with an LLM
  • ○ Eval set of real order messages