---
title: OpenClaw的IM机器人禁止群聊或限制配置白名单
description: "使用环境变量方式或在配置文件中直接写入Token值，都存在敏感信息泄露风险。为避免Token泄漏，应采用加密方式存储敏感数据，避免以明文形式存储，且定期进行修改。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcctrustzone/tee/cVMcont/kunpengtee_zjsj_openclaw_048.html
sourcePath: /source/zh/kunpengcctrustzone/tee/cVMcont/kunpengtee_zjsj_openclaw_048.html
indexId: df8c7fab824cd9efd5ff5e3e4e3da31b072765cd68a826bc3ec4c3ea478b606c75
---
# OpenClaw的IM机器人禁止群聊或限制配置白名单

#### 操作步骤

使用环境变量方式或在配置文件中直接写入Token值，都存在敏感信息泄露风险。为避免Token泄漏，应采用加密方式存储敏感数据，避免以明文形式存储，且定期进行修改。


- 方式一：

  1. 禁用企业微信群聊

```
openclaw config set channels.wecom.groupPolicy "disabled"
```


  2. 禁用QQ机器人群聊。

```
openclaw config set channels.qqbot.groupPolicy "disabled"
```


  3. 禁用Feishu群聊。

```
openclaw config set channels.feishu.groupPolicy "disabled"
```


  4. （可选）私聊白名单。

```
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
```

```
其中"123456789"请替换成要允许的实际用户ID
```


  5. 验证配置。

```
openclaw config get channels
```


  6. 重启OpenClaw网关。

```
openclaw gateway restart
```


- 方式二

  1. 打开配置文件。

```
vim
~
/.openclaw/openclaw.json
```


  2. 按“i”进入编辑模式，对群聊groupPolicy进行配置，禁止群聊或开放白名单配置。
    参考方案：禁止群聊配置

```
{
"channels": {
"wecom": {
"enabled": true,
"token": "your-stride-token",
"dmPolicy": "allowlist",
"groupPolicy": "disabled",
"allowFrom": ["私聊白名单用户的企业微信ID"]
},
"qqbot": {
"enabled": true,
"appId": "YOUR_APP_ID",
"clientSecret": "YOUR_APP_SECRET",
"dmPolicy": "allowlist",
"groupPolicy": "disabled"
"allowFrom": ["允许使用机器人的QQ号"]
},
"feishu": {
"enabled": true,
"appId": "cli_xxxxx",
"dmPolicy": "allowlist",
"groupPolicy": "disabled",
"allowFrom": ["允许的飞书用户ID"]
}
}
}
```


  3. 按“Esc”键退出编辑模式，输入:wq!，按“Enter”键保存并退出文件。
  4. 重启OpenClaw网关。

```
openclaw gateway restart
```
