Comanda: turn a WhatsApp message into an order with products, quantities and prices
The problem
In an Argentine SME, orders don't come through a web form: they come through WhatsApp, written like you'd say it to a person.
«hi! 2 dozen empanadas and a large coke»
Someone reads it and copies it by hand into a spreadsheet or a system. That step is where things break: orders get lost, undercharging, stock never matches.
Comanda automates that step.
How it works
The parser (lib/parser.ts) is deterministic, no language model. For a limited catalog —a grill, a kiosk, a distributor— rules are enough, cost nothing per message, and can't be abused. A model only comes in when the catalog is large or the customer's vocabulary is unpredictable.
It handles what appears in real messages:
| Input | Interpretation |
|---|---|
2 empanadas | quantity in digits |
tres chorizos | quantity written in words |
una docena de empanadas | sale units (dozen, half dozen) |
medio kilo de vacío · 1,5 kilos | products by weight, with comma decimal |
2 empandas | typos, by edit distance |
una coca grande vs una coca | longest alias wins, or undercharge |
3 milanesas, 2 chorizos y un agua | multiple products in one message |
hola! quiero … gracias | pleasantries, not missing products |
What it doesn't recognize is returned as missing instead of ignored: better for the client to see «couldn't find pizzas» than for the order to go out incomplete without anyone noticing.
Live demo
The demo simulates the conversation so you can try it without installing anything. Write a message with products and watch how it turns into an order with quantities and prices.
There's no WhatsApp connected behind the demo: the same parser runs behind the official WhatsApp Cloud API, which is what gets installed for each client.
There's no database either: order and stock state lives in each visitor's session, so two people testing at the same time don't overwrite each other.
Why deterministic
A language model can interpret any message, but:
- Costs per message. Every order goes through the API.
- Not deterministic. Same message can be interpreted differently twice.
- Can be abused. A prompt injection in a message can make the model ignore the catalog.
For a limited catalog, a rule-based parser handles 95% of cases without those costs. The remaining 5% —ambiguous orders, new products, very long messages— can be routed to a model or a human, but you don't need to start there.
Open source
The parser and demo are MIT licensed. The code is on GitHub and the demo runs at comanda.lykos.com.ar.