跳到正文
DEV Community· Ujjwal Dubey·· 2 小時前AI 評分59

在購買 AI 工具前,如何從 WhatsApp 聊天記錄匯出檔測量回覆時間

Measure Your Reply Times From a WhatsApp Chat Export Before You Buy an AI Tool

AI 導讀

文章示範如何從 WhatsApp 聊天匯出檔計算商家的首次回覆等待時間,建立購買 AI 工具前的基線。流程包括按日期格式解析訊息,並按時段及星期分組;作者建議在業主的裝置上處理資料、刪除原始匯出檔,只保留計算結果。這些數據可用來界定工具應改善的回覆時段。

正文

Every AI tool pitch promises faster replies. Few owners know how fast they reply today, so there is nothing to compare against after launch. If the business runs on WhatsApp, you can get a rough baseline from a chat export in an afternoon.

This is a small, practical part of auditing a workflow with real history before buying AI: measure the waits first, then decide what to automate.

1. Export a few chats

From the business phone, export a handful of customer chats as text, without media. The export is a plain text file with one message per line, starting with a date and time. The exact format varies by phone, app version and locale, so look at your file before writing the parser.

Two common shapes look like this:

19/10/2026, 09:14 - Customer: Hi, is the blue kurta available in M?
[19/10/2026, 09:14:05] Customer: Hi, is the blue kurta available in M?

2. Parse it

import re
from datetime import datetime

LINE = re.compile(
    r"^\[?(\d{1,2}/\d{1,2}/\d{2,4}),? (\d{1,2}:\d{2}(?::\d{2})?)\]?(?: -)? ([^:]+): (.*)$"
)

def parse(path, fmt_date="%d/%m/%Y"):
    msgs = []
    for raw in open(path, encoding="utf-8"):
        m = LINE.match(raw.strip())
        if not m:
            if msgs:                       # continuation of a multi-line message
                msgs[-1]["text"] += "\n" + raw.strip()
            continue
        d, t, who, text = m.groups()
        tfmt = "%H:%M:%S" if t.count(":") == 2 else "%H:%M"
        ts = datetime.strptime(f"{d} {t}", f"{fmt_date} {tfmt}")
        msgs.append({"ts": ts, "who": who.strip(), "text": text})
    return msgs

Adjust fmt_date (for example %m/%d/%y) and the time format if your export uses 12-hour times with AM/PM.

3. Compute first-reply waits

A "wait" starts when the customer sends a message after the business has gone quiet, and ends at the next business message.

def waits(msgs, business_names):
    out, open_at = [], None
    for m in msgs:
        is_business = m["who"] in business_names
        if not is_business and open_at is None:
            open_at = m["ts"]
        elif is_business and open_at is not None:
            out.append((open_at, (m["ts"] - open_at).total_seconds() / 60))
            open_at = None
    return out

Group the results by hour of day and by weekday. The pattern usually matters more than the average: replies may be quick at noon and slow after 7 p.m., or slow every Monday morning.

4. Keep it private

Run this on the owner's machine. Do not upload chat exports to random online tools. Delete the raw exports when you are done, and keep only the computed waits.

What to do with the numbers

Write down two or three of them in plain words: "evening enquiries wait the longest", "Monday mornings are slow". Those sentences become the success measure for whatever you build or buy. If a vendor cannot say how their tool would change them, keep looking.

Disclosure: I run NxFlowAI, an AI automation agency. We measure a baseline like this in our first audit, which takes 72 hours for one workflow.

來源:DEV Community · dev.to