Zaid Bin Haris Available for new work
All work

WhatsApp order extraction

Matching products when the catalogue has no keys and the customer writes in two languages

Turning free-form WhatsApp haggling into matched orders against a hand-kept catalogue with no clean keys, for an oil-blend vendor.

  • Year
    2026
  • straight through
    85%
  • Stack
    Meta Coexistence API, Python, PostgreSQL
  • Status
    Not public
WhatsApp order extractiondeterministicmodel
A five-stage order-matching pipeline Incoming free-form messages pass through exact match, an alias table, and a confidence gate. Most resolve deterministically. Only the remainder reach the language model, and anything still ambiguous is diverted to one-tap human approval. input exact string equality alias table learns from corrections gate confidence threshold model language only order one-tap human approval

The problem

A vendor sells oil blends through WhatsApp. Customers negotiate in free text, in a mixture of English and Roman Urdu, against a catalogue that is maintained by hand and has no stable identifiers. Orders were being read and entered manually.

The constraint

The catalogue is full of near-duplicates. HD 50, HD-50 and HD/50 are the same product. Spellings drift, transliteration varies by customer, and the same blend has different informal names depending on who is asking.

The sales channel also could not be disrupted. The vendor was not going to move customers to a portal, so whatever was built had to sit on the existing WhatsApp conversation without changing how it felt to either side. That ruled out anything that required the customer to phrase things a particular way.

The decision

A single embedding lookup over a catalogue like this is wrong often enough to be useless, and worse, it is wrong confidently. So the pipeline is tiered instead, and each tier is cheaper and more certain than the one after it.

Exact string match first. Then an alias and tag table. Then confidence-gated fuzzy matching. Then, for anything still ambiguous, a one-tap human approval rather than a guess.

The part that compounds is the feedback: every human correction is written back into the alias table. The ambiguous long tail shrinks with use rather than with re-tuning, so the system gets better because it is being used, not because someone is maintaining it.

Resolving “the usual”

Customers refer to previous orders constantly. The usual at the usual rate is a complete instruction to a human who knows the account.

The wrong way to handle that is to give the model a long chat history and hope it recalls correctly, because that is exactly where it invents details. Instead the contact's prior confirmed orders are retrieved from Postgres and injected into the prompt as structured facts. The model is reading a record rather than remembering one.

The result

Roughly 80 to 85 per cent of line items match automatically, on a catalogue with no clean keys and input in two languages. The rest surface for one tap rather than silently going wrong.

At a glance

Client
Oil-blend vendor
Channel
Live WhatsApp, undisturbed
Languages
English and Roman Urdu
Match rate
~80 to 85% automatic