Gold-rate messages are one of the first things Indian jewellers ask to automate. The code is easy; the safety rules are the work. This is a sketch I would hand to anyone building AI automation for jewellery retail India teams can switch off with one reply.
customers.csv
customer_id,phone_e164,opt_in,frequency,last_sent
C001,+91XXXXXXXXXX,yes,daily,2026-11-09
C002,+91XXXXXXXXXX,yes,festival,2026-10-20
C003,+91XXXXXXXXXX,no,,
Script
import csv, datetime, sys
TODAY = datetime.date.today()
FESTIVAL_DAYS = set() # filled by staff, e.g. {"2026-11-10"}
def due(row):
if row["opt_in"] != "yes":
return False
if row["frequency"] == "daily":
return row["last_sent"] != TODAY.isoformat()
if row["frequency"] == "festival":
return TODAY.isoformat() in FESTIVAL_DAYS
return False
def send(phone, text): # stub: call your WhatsApp provider here
print("SEND", phone, text)
def main(rate_text, approved_by, dry_run=True):
if not rate_text.strip():
sys.exit("No rate entered today: nothing sent.")
rows = list(csv.DictReader(open("customers.csv", encoding="utf-8")))
queue = [r for r in rows if due(r)]
print(f"{len(queue)} customers due; approved by: {approved_by or 'NOBODY'}")
if dry_run or not approved_by:
for r in queue[:5]:
print("PREVIEW", r["customer_id"], rate_text)
return
msg = rate_text + "\nReply STOP to stop these updates."
for r in queue:
send(r["phone_e164"], msg)
if __name__ == "__main__":
main(rate_text=sys.argv[1] if len(sys.argv) > 1 else "", approved_by=None)
Rules baked in
- No rate, no send. The rate is typed by staff; the script never invents one.
- Dry run by default. It previews until a named person approves.
- Opt-in only, with frequency. "festival" customers only get messages on days staff mark.
-
Every message has a stop line. Handle "STOP" replies by setting
opt_intonostraight away. - Template rules. Business-initiated WhatsApp messages need approved templates; check with your provider.
Before automating any customer message, we map the whole flow first. The Site Roaster read of a jeweller's homepage is a free way to see how the showroom site looks to a first-time buyer while you plan.
Disclosure: I co-founded NxFlowAI, a Mumbai-based AI automation agency.
Top comments (0)