群组消息(WhatsApp web 频道)
目标:让 Clawd 加入 WhatsApp 群组,仅在被 ping 时唤醒,并将该线程与个人 DM 会话分离。说明:agents.list[].groupChat.mentionPatterns 现也被 Telegram/Discord/Slack/iMessage 使用;本文聚焦 WhatsApp 特定行为。对多代理设置,可按代理设置 agents.list[].groupChat.mentionPatterns(或用 messages.groupChat.mentionPatterns 作为全局回退)。
已实现内容(2025-12-03)
- 激活模式:
mention(默认)或always。mention需 ping(通过mentionedJids的真实 WhatsApp @-提及、正则模式、或文本中任意位置的机器人 E.164)。always在每条消息时唤醒代理,但应仅在能提供有意义价值时回复;否则返回静默 tokenNO_REPLY。默认可在配置(channels.whatsapp.groups)中设置,并可通过/activation按群组覆盖。设置channels.whatsapp.groups时也作为群组白名单(包含"*"表示允许全部)。 - 群组策略:
channels.whatsapp.groupPolicy控制是否接受群组消息(open|disabled|allowlist)。allowlist使用channels.whatsapp.groupAllowFrom(回退:显式channels.whatsapp.allowFrom)。默认为allowlist(阻止直到添加发送方)。 - 按群组会话:会话键形如
agent:<agentId>:whatsapp:group:<jid>,故/verbose on或/think high等命令(作为独立消息发送)作用于该群组;个人 DM 状态不受影响。群组线程会跳过心跳。 - 上下文注入:仅未决的群组消息(默认 50 条)若_未_触发运行,会在
[Chat messages since your last reply - for context]下作为前缀,触发行在[Current message - respond to this]下。已在会话中的消息不会重新注入。 - 发送方显示:每个群组批次现在以
[from: Sender Name (+E164)]结尾,让 Pi 知道谁在说话。 - 临时/仅查看:在提取文本/提及前解包,故其中的 ping 仍会触发。
- 群组系统提示:群组会话首轮(及每次
/activation改变模式时)向系统提示注入简短说明,如You are replying inside the WhatsApp group "<subject>". Group members: Alice (+44...), Bob (+43...), … Activation: trigger-only … Address the specific sender noted in the message context.。若元数据不可用仍会告知代理这是群聊。
配置示例、激活命令、使用方法、测试/验证、已知考量见英文 群组消息 文档。
最后更新于: