Configuration
WhatsApp समूह संदेश
क्रॉस-चैनल समूह मॉडल (Discord, iMessage, Matrix, Microsoft Teams, Signal, Slack, Telegram, WhatsApp, Zalo) के लिए, समूह देखें। यह पेज उस मॉडल के ऊपर WhatsApp-विशिष्ट व्यवहार कवर करता है: सक्रियण, समूह allowlists, प्रति-समूह session keys, और pending-message context injection.
लक्ष्य: OpenClaw को WhatsApp समूहों में रहने दें, केवल ping किए जाने पर जगाएं, और उस thread को व्यक्तिगत DM session से अलग रखें।
व्यवहार
- सक्रियण modes:
mention(default) याalways।mentionके लिए ping चाहिए (वास्तविक WhatsApp @-mentions viamentionedJids, safe regex patterns, या text में कहीं भी bot का E.164)।alwaysहर message पर agent को जगाता है लेकिन उसे केवल तभी reply करना चाहिए जब वह meaningful value जोड़ सके; अन्यथा यह exact silent tokenNO_REPLY/no_replyलौटाता है। Defaults config (channels.whatsapp.groups) में सेट किए जा सकते हैं और/activationके जरिए प्रति group override किए जा सकते हैं। जबchannels.whatsapp.groupsसेट हो, तो यह group allowlist के रूप में भी काम करता है (सभी को allow करने के लिए"*"शामिल करें)। - समूह नीति:
channels.whatsapp.groupPolicyनियंत्रित करता है कि group messages स्वीकार किए जाते हैं या नहीं (open|disabled|allowlist)।allowlistchannels.whatsapp.groupAllowFromका उपयोग करता है (fallback: explicitchannels.whatsapp.allowFrom)। Defaultallowlistहै (senders जोड़ने तक blocked)। - प्रति-समूह sessions: session keys
agent:<agentId>:whatsapp:group:<jid>जैसी दिखती हैं ताकि/verbose on,/trace on, या/think highजैसे commands (standalone messages के रूप में भेजे गए) उसी group तक scoped रहें; व्यक्तिगत DM state अछूती रहती है। Heartbeat group threads के लिए skip किए जाते हैं। - Context injection: pending-only group messages (default 50) जो run trigger नहीं करते, उन्हें
[Chat messages since your last reply - for context]के अंतर्गत prefix किया जाता है, और triggering line[Current message - respond to this]के अंतर्गत होती है। Session में पहले से मौजूद messages दोबारा inject नहीं किए जाते। - Sender surfacing: हर group batch अब
[from: Sender Name (+E164)]के साथ समाप्त होता है ताकि OpenClaw जान सके कि कौन बोल रहा है। - Ephemeral/view-once: text/mentions निकालने से पहले हम उन्हें unwrap करते हैं, इसलिए उनके अंदर के pings अभी भी trigger करते हैं।
- Group system prompt: group session के पहले turn पर (और जब भी
/activationmode बदलता है) हम system prompt में एक छोटा blurb inject करते हैं जैसे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.यदि metadata उपलब्ध नहीं है, तब भी हम agent को बताते हैं कि यह group chat है।
Config example (WhatsApp)
~/.openclaw/openclaw.json में groupChat block जोड़ें ताकि display-name pings तब भी काम करें जब WhatsApp text body में visual @ हटा देता है:
{ channels: { whatsapp: { groups: { "*": { requireMention: true }, }, }, }, agents: { list: [ { id: "main", groupChat: { historyLimit: 50, mentionPatterns: ["@?openclaw", "\\+?15555550123"], }, }, ], },}नोट्स:
- Regexes case-insensitive हैं और अन्य config regex surfaces जैसे ही safe-regex guardrails का उपयोग करते हैं; invalid patterns और unsafe nested repetition ignore किए जाते हैं।
- जब कोई contact tap करता है तो WhatsApp अभी भी canonical mentions
mentionedJidsके जरिए भेजता है, इसलिए number fallback की जरूरत कम पड़ती है लेकिन यह उपयोगी safety net है।
सक्रियण command (owner-only)
Group chat command का उपयोग करें:
/activation mention/activation always
केवल owner number (from channels.whatsapp.allowFrom, या unset होने पर bot का अपना E.164) इसे बदल सकता है। Current activation mode देखने के लिए group में standalone message के रूप में /status भेजें।
उपयोग कैसे करें
- अपने WhatsApp account (जो OpenClaw चला रहा है) को group में जोड़ें।
@openclaw …कहें (या number शामिल करें)। जब तक आपgroupPolicy: "open"सेट नहीं करते, केवल allowlisted senders इसे trigger कर सकते हैं।- Agent prompt में recent group context और trailing
[from: …]marker शामिल होगा ताकि वह सही व्यक्ति को address कर सके। - Session-level directives (
/verbose on,/trace on,/think high,/newया/reset,/compact) केवल उस group के session पर लागू होते हैं; उन्हें standalone messages के रूप में भेजें ताकि वे register हों। आपका व्यक्तिगत DM session independent रहता है।
Testing / verification
- Manual smoke:
- Group में
@openclawping भेजें और sender name का reference देने वाला reply confirm करें। - दूसरा ping भेजें और verify करें कि history block शामिल है और फिर next turn पर clear हो जाता है।
- Group में
- Gateway logs (
--verboseके साथ run करें) check करें ताकिfrom: <groupJid>और[from: …]suffix दिखाने वालीinbound web messageentries दिखें।
ज्ञात विचार
- Groups के लिए Heartbeats जानबूझकर skip किए जाते हैं ताकि noisy broadcasts से बचा जा सके।
- Echo suppression combined batch string का उपयोग करता है; यदि आप mentions के बिना identical text दो बार भेजते हैं, तो केवल पहले को response मिलेगा।
- Session store entries session store (
~/.openclaw/agents/<agentId>/sessions/sessions.jsonby default) मेंagent:<agentId>:whatsapp:group:<jid>के रूप में दिखाई देंगी; missing entry का मतलब केवल इतना है कि group ने अभी तक run trigger नहीं किया है। - Groups में typing indicators
agents.defaults.typingModeका पालन करते हैं। जब visible replies message-tool-only mode में opt into किए जाते हैं, typing default रूप से तुरंत शुरू हो जाती है ताकि group members देख सकें कि agent काम कर रहा है, भले ही कोई automatic final reply post न हो। Explicit typing-mode config फिर भी wins करता है।