Rate This Document
Findability
Accuracy
Completeness
Readability

Disable Group Chats or Configure an Allowlist for OpenClaw IM Bots

Procedure

Storing token values directly in environment variables or configuration files poses a risk of sensitive information leakage. To mitigate this risk, encrypt and store sensitive data instead of using plain text, and rotate tokens periodically.

  • Method 1
    1. Disable WeCom group chat.
      openclaw config set channels.wecom.groupPolicy "disabled"
    2. Disable group chat for the QQ bot.
      openclaw config set channels.qqbot.groupPolicy "disabled"
    3. Disable Feishu group chats.
      openclaw config set channels.feishu.groupPolicy "disabled"
    4. (Optional) Configure the private chat allowlist.
      openclaw config set channels.wecom.dmPolicy "allowlist"
      openclaw config set channels.wecom.allowFrom '["123456789"]' --json
      
      openclaw config set channels.qqbot.dmPolicy "allowlist"
      openclaw config set channels.qqbot.allowFrom '["123456789"]' --json
      
      openclaw config set channels.feishu.dmPolicy "allowlist"
      openclaw config set channels.feishu.allowFrom '["123456789"]' --json
      Replace 123456789 with the actual user ID to be allowed.
    5. Verify the configuration.
      openclaw config get channels
    6. Restart the OpenClaw gateway.
      openclaw gateway restart
  • Method 2
    1. Open the configuration file.
      vim ~/.openclaw/openclaw.json
    2. Press i to enter the insert mode and configure groupPolicy to disable group chats or enable the allowlist.

      Reference solution: Disable group chats.

      {
        "channels": {
          "wecom": {
            "enabled": true,
            "token": "your-stride-token",
            "dmPolicy": "allowlist",
            "groupPolicy": "disabled",
            "allowFrom": ["WeCom_ID_of_the_allowed_private_chat_user"]
          },
          "qqbot": {
            "enabled": true,
            "appId": "YOUR_APP_ID",
            "clientSecret": "YOUR_APP_SECRET",
            "dmPolicy": "allowlist",
            "groupPolicy": "disabled"
            "allowFrom": ["QQ_number_of_the_allowed_user"]      
          },
          "feishu": {
            "enabled": true,
            "appId": "cli_xxxxx",
            "dmPolicy": "allowlist",
            "groupPolicy": "disabled",
            "allowFrom": ["Feishu_user_ID_of_the_allowed_user"]
          }
        }
      }
    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
    4. Restart the OpenClaw gateway.
      openclaw gateway restart