一筆訂單,一個識別碼:設計印度 WhatsApp 自動化可配對的訂單編號方案
One Order, One Reference: Designing an Order-ID Scheme That Indian WhatsApp Automations Can Actually Match
這套面向印度 WhatsApp 自動化的訂單編號方案,建議在查詢轉為訂單時建立內部識別碼,並把各系統的編號關聯至同一筆訂單。編號由 ORD- 前綴及 6 個隨機字元組成,避開容易混淆的 O、I、0、1;發票、UPI 付款參考及快遞單號則另行記錄。付款配對由模型草擬、人員核准,修改數量時沿用原編號並記錄變更。
Most small Indian businesses I talk to have the same quiet problem: the order exists in four places and none of them share a key. The customer's WhatsApp chat says "the blue one, 2 pieces". The invoice software has its own number. The payment screenshot has a UPI reference. The courier has a docket number. A person in the shop holds it all together by memory.
Before anyone, including an AI automation agency India teams hire to connect WhatsApp to their books, can automate status replies, that memory has to become a reference scheme.
The rule: mint your own ID at the first message
Do not wait for the invoice. Create an internal order reference the moment an enquiry turns into an order, and send it to the customer in the confirmation message.
import secrets, string
ALPHABET = string.ascii_uppercase.replace('O', '').replace('I', '') + '23456789'
def order_ref(prefix='ORD'):
# short, readable over a phone call, no O/0 or I/1 confusion
return prefix + '-' + ''.join(secrets.choice(ALPHABET) for _ in range(6))
Short and readable matters more than clever. Customers will read this back to you on a call.
Store the other IDs against it, never instead of it
CREATE TABLE order_refs (
order_ref TEXT PRIMARY KEY,
wa_phone TEXT NOT NULL, -- normalised +91 number
invoice_no TEXT, -- filled when billing creates it
payment_ref TEXT, -- UPI/UTR text, typed or approved by a person
docket_no TEXT, -- courier, if any
status TEXT NOT NULL DEFAULT 'confirmed',
updated_at TIMESTAMP NOT NULL
);
Each later system adds its own number to the same row. Status replies then look up one key.
Three edge cases to design for
- One chat, many orders. Repeat customers order again in the same thread. Always ask "which order?" when more than one is open, and show the references.
- Payment reference typed by a person. Do not let a model read a screenshot and mark an order paid. Let it draft the match; a person approves.
- Edits after confirmation. Changing quantity should keep the reference and log the change, not mint a new one.
What this unlocks
With one reference per order, "where is my order?" stops being a search through chats. It becomes a lookup, and a draft reply a person can approve in one tap. If you want to think through which step to automate first, our post on auditing one workflow before you buy AI walks through it.
I run NxFlowAI, an AI automation agency in Mumbai. The code above is illustrative and dependency-free.
來源:DEV Community · dev.to