WhatsApp 閘道
這是什麼
透過 WhatsApp 控制或接收 Hermes 工作的訊息介面。
白話解釋
Hermes 不直接與 WhatsApp 通訊;它反而聘請了一個小中介——一個獨立的輔助程式,代它登入 WhatsApp Web——並且只與那個中介對任何進來的內容所做的整齊翻譯打交道。如果中介的班次意外結束,Hermes 會在下次啟動時注意到並僱用一個新的,而不是無限期地等待舊的回來。
為什麼重要
與 Telegram 相同的行動命令中心模式延伸到了這個許多非技術使用者已經經常開啟的平台,這對於旨在接觸那些不會去檢查儀表板的人的工作流程來說很重要。它與 Telegram 和 Discord 共享相同的底層閘道服務和工具集註冊模式,主要區別在於平台特定的插件處理 WhatsApp 的連線需求。對於像 CRM 客戶資料獲取這樣的商業工作流程,這通常是符合資格的進站訊息首次出現的頻道。
How it works
WhatsAppAdapter (plugins/platforms/whatsapp/adapter.py) never opens a WhatsApp connection itself. It launches and manages a local Node.js subprocess running the Baileys WhatsApp Web library, talking to it over a small HTTP API — the code’s own comments call this a ‘bridge pattern.’ The adapter tracks that subprocess by writing its process ID to a bridge.pid file, and on startup checks whether an old bridge from a crashed run is still listening on the port so it can kill the stale one before starting a fresh bridge, rather than failing to bind. The whole adapter stays inactive unless WHATSAPP_ENABLED is explicitly set, and once running it applies the same allowlist and DM/group policy pattern used by Hermes’s other messaging adapters.