每天自動從紀錄中抓出「熱門關鍵字」,幫助你快速了解客戶最關心什麼(例如:「價格」、「優惠」、「出貨」、「退款」)。
新增一個 Google Sheet → Read 節點
或者用 資料庫節點 (SELECT):
SELECT original_message
FROM customer_messages
WHERE DATE(created_at) = CURDATE();
加一個 Function 節點:
用簡單的字詞分割與統計。
const messages = $input.all().map(item => item.json.original_message);
const wordCount = {};
for (const msg of messages) {
const words = msg.replace(/[^\p{L}\p{N}]/gu, ' ').split(/\s+/);
for (const w of words) {
if (w.length > 1) wordCount[w] = (wordCount[w] || 0) + 1;
}
}
const sorted = Object.entries(wordCount)
.sort((a,b) => b[1] - a[1])
.slice(0, 10)
.map(([word, count]) => `${word}:${count}次`);
return [{ json: { summary: sorted.join('\n') } }];
加上 Email 節點
Subject: 今日熱門客服關鍵字
Text:
以下是今天最常被提到的關鍵字:
{{ $json["summary"] }}
發送幾筆測試訊息到 Webhook,例如:
執行 workflow,確認收到的 Email 內容像這樣👇
以下是今天最常被提到的關鍵字:
價格:3次
優惠:2次
退款:1次