跳到正文
DEV Community· Shoeb Reza | Arwahyn AI·· 2 天前AI 評分54

Arwahyn AI 的 WhatsApp AI 接待員不自行報價,管理員用「A12 ok」發送草擬回覆

Our WhatsApp AI receptionist isn't allowed to talk about money. It texts me first, and I answer with "A12 ok"

AI 導讀

Arwahyn AI 為 WhatsApp AI 接待員設定規則,不讓它自行報價或答應會面;回覆一旦含有疑似價格,便會轉交管理員處理。流程使用 n8n、自架於 Railway 的 OpenWA gateway 和 Supabase 作記憶,並等待 20 秒後只回覆最新訊息。

正文

Shoeb Reza | Arwahyn AI

Most WhatsApp bots I've seen fail the same way: a customer asks "how much for X", the bot makes up a number or quotes an old one, and now the owner either honours a price he never set or looks like he's going back on his word. So when we built our own, the first rule was that the AI never states a price or agrees to a meeting on its own.

The stack is n8n plus a self-hosted WhatsApp gateway (OpenWA), both on Railway, with Supabase as the memory. Here's how a message moves through it:

  1. It waits 20 seconds and only answers the newest message. People on WhatsApp send three short messages in a row, and answering each one separately looks robotic.
  2. It reads the real chat history before replying, so it knows whether this is a first contact or a client we've been talking to for weeks.
  3. It stays out of human conversations. If I've written in that chat in the last 48 hours, or I'm replying myself, the bot holds back for 12 hours. If I've ever spoken to that person directly, it never jumps in on a first message.
  4. The model returns JSON, not text: reply, ask_admin or silent. Only reply goes to the customer.
  5. A regex guard runs after the model. If the reply contains anything that looks like a price, it gets turned into ask_admin, even if the model thought it was fine.
  6. ask_admin sends me a numbered note on my own phone, like "A12: they want a quote for a website + WhatsApp bot, what should I say?". I answer "A12 ok" to send the drafted reply, "A12 " to send my words instead, or "A12 skip".
  7. Every reply is logged before it's sent, so when WhatsApp echoes the bot's own message back, the workflow doesn't mistake it for me typing and go quiet.

Think of it like a good shop assistant in their first week: they greet everyone, answer the easy questions, and walk over to the owner before agreeing to any discount.

Things that took longer than expected

  • WhatsApp group IDs and the newer "LID" contact IDs don't look like phone numbers, so matching "is this the owner?" needed both formats.
  • Without the 20-second wait, two workflow runs would answer the same burst twice.
  • Bulk messages only go to people who opted in, at a slow rate inside working hours. Anything faster is how numbers get banned.

I run Arwahyn AI, an AI automation agency in Dhaka.

來源:DEV Community · dev.to