Every automation conversation eventually hits the question "how often does this actually happen?" Owners guess. Guesses are usually wrong in both directions.
If you are preparing for an AI workflow audit with real request counts, you can answer that question in an afternoon with an export of your inbox and a short script. Everything runs locally.
1. Export
Most email tools can export a mailbox or a label as .mbox. Help-desk tools and some WhatsApp inbox providers export CSV. The script below handles mbox; adapting it for CSV is a few lines.
2. Tally by rough category
import mailbox, re, collections, csv
from email.header import decode_header, make_header
RULES = [ # edit to match your business; first match wins
("quote_request", r"\b(quote|quotation|price|pricing|rate)\b"),
("order_status", r"\b(where is|status|tracking|dispatch|delivered)\b"),
("booking", r"\b(book|appointment|slot|reschedul)"),
("invoice_payment", r"\b(invoice|payment|receipt|paid|refund)\b"),
("complaint", r"\b(not happy|complain|wrong|damaged|broken)\b"),
]
def subject(msg):
try:
return str(make_header(decode_header(msg.get("subject", ""))))
except Exception:
return msg.get("subject", "") or ""
def categorise(text):
t = text.lower()
for name, pattern in RULES:
if re.search(pattern, t):
return name
return "other"
counts = collections.Counter()
samples = collections.defaultdict(list)
for msg in mailbox.mbox("inbox.mbox"):
s = subject(msg)
c = categorise(s)
counts[c] += 1
if len(samples[c]) < 5:
samples[c].append(s)
with open("request_tally.csv", "w", newline="") as f:
w = csv.writer(f)
w.writerow(["category", "count", "examples"])
for c, n in counts.most_common():
w.writerow([c, n, " | ".join(samples[c])])
print(counts.most_common())
3. Read the "other" bucket
This is the important part. The other category is where you discover requests nobody thought to name. Read a sample, add a rule, run again. Two or three passes usually get "other" small.
4. What to bring to the audit
- The tally CSV.
- Five examples per category, including one that went badly.
- A note on which categories need a human decision (prices, refunds, complaints).
Limits
Subject lines are a rough signal: replies, forwards and vague subjects ("Hi") hide the real request. Treat the result as a ranking, not a measurement. It is still far better than a guess, and it points the audit at the categories that actually repeat.
If, after counting, you suspect a ready-made tool would do the job, read the case for packaged bots versus custom builds first.
Disclosure: I co-founded NxFlowAI, an AI automation agency in Mumbai. The script is free to use.
Top comments (0)