work/orderly/
Orderly
WhatsApp questions answered from the live catalogue, so kirana owners stop replying by hand
Solo: owner app, WhatsApp bot · 2026

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
- triggerA customer sends a WhatsApp message to the shop.
- step 1The bot answers price and stock questions from the live Supabase catalogue.
- step 2Owner replies typed in the app are relayed to WhatsApp through the bot.
- step 3Order status changes only through a state machine; money is stored in integer paise; Supabase RLS keeps each shop's data apart.
- 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.
- 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.
- user
- external
- service
- guard
- data
- client
- call
- logical link
- ← scroll →
- 01Buyer sends a WhatsApp message
- 02Bot parses the intent and looks up the live catalogue
- 03Order moves through a state machine in Supabase
- 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.
- user
- external
- service
- guard
- data
- client
- call
- logical link
- ← scroll →
- user
Customer on WhatsApp
no app install
- external
whatsapp-web.js session
linked to the shop's number by QR
- service
Bot process (Node.js, BuilderBot)
runs under a crash supervisor
reads + writes
dataSupabase Postgres
shops · items · orders · RLS
clientOwner app
React + Vite · Clerk · orders, chats, inventory
- user
Message arrives
group or channel message → ignored
- service
Normalise the phone number
- data
Look up the shop in Supabase
no shop linked → reply "not linked yet", stop
- service
Classify: greeting · hours · address · delivery · item
- data
Item request: search the live catalogue
partial name match · up to 5 results · live price and stock
- service
Compose and send the reply
lookup fails → log it, still send a short apology
- guard
Order status changes go through the state machine
- service
Supervisor starts the bot
- data
Heartbeat every 45 s
owner app shows the bot as live
- service
Bot crashes
restarted automatically
- guard
5 crashes within 30 s
supervisor stops restarting; missed heartbeats show in the owner app
- ● draft
- pending_payment
- placed
- confirmed
- ready
- completed
cancelled → refunded
cancelled orders move to refunded once money is returned
Adding an LLM before the channel is reliable
Rule-based parsing for now
Reliability of the WhatsApp channel was the bigger problem; an AI parser is the planned next step.
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