Home Tutorials Categories Skills About
ZH EN JA KO
Channels

OpenClaw WhatsApp Group Feature Configuration Guide

· 12 min read

OpenClaw natively supports WhatsApp channels, using the Baileys library under the hood to connect via QR code pairing. Beyond basic one-on-one private messaging, WhatsApp group functionality is a key area of interest for many users. This article provides a detailed guide on configuring and optimizing AI assistant behavior in WhatsApp group chats.

How WhatsApp Group Chat Works

Once OpenClaw connects to WhatsApp, the Bot account (which is essentially the WhatsApp number you scanned to log in) can be added to groups, or the Bot can create groups on its own. In a group chat environment, the Bot receives all messages in the group, but by default does not reply to every message — a sensible default setting.

Group Chat Trigger Modes

OpenClaw provides flexible trigger mechanisms for WhatsApp group chats. You can configure them in openclaw.json:

{
  "channels": {
    "whatsapp": {
      "enabled": true,
      "groups": {
        "triggerMode": "mention",
        "mentionKeywords": ["@ai", "@bot"],
        "replyToBot": true
      }
    }
  }
}

Mention Mode: The AI is only triggered when a message contains specific keywords. Since WhatsApp group chats lack native @mention functionality like Telegram, OpenClaw simulates this behavior by detecting keywords in the message text. When a user sends a message containing @ai or @bot, the AI is triggered to reply.

Quote Reply Mode (replyToBot): When replyToBot is set to true, users quoting (replying to) a previous Bot message will also trigger an AI reply. This creates a natural conversation thread.

Respond to All Mode: Setting triggerMode to all makes the Bot respond to every message in the group. This is only suitable for small, dedicated AI groups and is not recommended for regular group chats.

Group Allowlist

To restrict the Bot to operate only in specific groups, you can configure a group allowlist:

{
  "channels": {
    "whatsapp": {
      "groups": {
        "allowedGroups": [
          "[email protected]",
          "[email protected]"
        ]
      }
    }
  }
}

WhatsApp group IDs follow the format [email protected]. You can find the group IDs the Bot has joined in the OpenClaw logs. If allowedGroups is not configured, the Bot will respond in all groups it has been added to (subject to trigger mode restrictions).

User Permissions in Groups

In group chat scenarios, you may want to restrict which users can trigger the AI. OpenClaw supports group-level user allowlists:

{
  "channels": {
    "whatsapp": {
      "groups": {
        "userAllowlist": ["[email protected]"],
        "adminOnly": false
      }
    }
  }
}

Setting adminOnly to true means only group admins can trigger AI replies. This is useful in large groups to prevent regular members from overusing AI resources.

Context Management

Conversation context in group chats is more complex than in private chats. Multiple users interact with the AI simultaneously, with messages interleaved. OpenClaw uses the following strategies for group chat context:

Reply-Chain-Based Context: When users interact with the AI through quote replies, OpenClaw builds context along the reply chain to ensure conversation coherence.

Per-User Context Isolation: Each user's conversation context with the AI in a group is independent by default. User A's conversation does not affect User B's conversation history.

Shared Context Mode: If you want all users to share the same conversation context, set "contextMode": "shared". This is suitable for team collaboration scenarios where everyone can see and continue conversations based on previous exchanges.

{
  "channels": {
    "whatsapp": {
      "groups": {
        "contextMode": "per_user",
        "maxContextMessages": 20
      }
    }
  }
}

Message Format Considerations

WhatsApp supports basic text formatting (bold, italic, etc.) but does not support the full Markdown syntax. OpenClaw automatically converts Markdown formatting in AI replies to WhatsApp-compatible formats. For example, **bold** is preserved, but code blocks and tables are simplified to plain text format.

Private Message Pairing in Groups

OpenClaw's private message pairing feature is particularly useful in group chat scenarios. You can require group users to complete identity verification via private message with the Bot before using AI features in the group. This provides an additional layer of security:

{
  "channels": {
    "whatsapp": {
      "groups": {
        "requirePairing": true
      }
    }
  }
}

When enabled, unpaired users who trigger the AI in the group will receive a private message from the Bot guiding them through the pairing process.

Best Practices

When deploying an AI assistant in WhatsApp groups, it is recommended to use mention mode rather than respond-to-all mode to avoid message floods. Set reasonable rate limits for the group to prevent individual users from overusing the service. Regularly clean up conversation context to control memory usage. Also, ensure the Bot's display name and avatar clearly indicate that it is an AI assistant to avoid user confusion.

OpenClaw is a free, open-source personal AI assistant that supports WhatsApp, Telegram, Discord, and many more platforms