Py’otrMuhammad Toheed Sahar

WhatsApp sales agent for a Shopify store

A WhatsApp assistant that answers customers in their own script, collects orders, and holds every order for an owner to approve before anything reaches Shopify.

Client
A Pakistani online apparel store (cash on delivery)
Year
2026
Type
Automation & bots

The problem

The owners of a cash-on-delivery online store wanted customer chats handled around the clock without a generic-AI feel, and without a wrong order ever being created. Customers write in Roman Urdu, Urdu script and English, and the owners phone every customer to confirm before shipping.

How I built it

A Python service connects to the shop's WhatsApp number through a self-hosted gateway, reads the catalogue from the Shopify store, and replies in the owners' own chat style. Orders are stored as pending verification. Nothing goes to Shopify until an owner sends a strict approval command, matched by rules and never interpreted by a model. The owners get summaries twice a day. Phone numbers and addresses are masked before any text reaches a model.

What got hard

  1. A first overnight run on real chats (106 chats, 502 messages) showed where the rules had to be tighter: replies came a median 54 minutes late, the same question was repeated 85 times across 13 chats, junk was saved as customer names, and an order was noted after the customer had cancelled.

    I switched it off the next morning, saved the 106 chats with numbers masked, and rebuilt against them. Replies are now sent as one complete message after a 2 to 5 minute pause, and the second product the store sells (customers had been asking about sizes 32 and 'foam or cotton') became part of the catalogue.

  2. Cancel wording in Roman Urdu is easy to get wrong: 'cancel kardo' cancels an order and 'cancel to mat karna' (please do not cancel) must not.

    I attacked the rules with sets of tricky sentences until a sentence that does not cancel an order cancelled it 0 times in 25. Order, cancel and hand-off rules sit in code, not in the model.

  3. A replay test showed three customer names reaching the model provider.

    I added a masking layer with a hard check that blocks the model call if masking fails, and a deploy setting that forces the mode (off, test or live), so a typo cannot start live mode. In test mode no real customer is answered and nothing reaches the model provider.

  4. Proving the tests can fail, not just pass.

    I built a simulation harness with scripted conversations and planted deliberate faults: 15 of 15 were caught in the conversation rules and 7 of 7 in the owner desk. The latest run records 102 of 102 conversation cases, 110 of 110 model-layer tests and 10 of 10 test-mode checks.

The result

Built and tested. As of the last record the bot is switched off, and go-live is held until the owners have read a sample of its replies, so I describe it as ready for a test deploy, not as live.