82 lines
1.8 KiB
Markdown
82 lines
1.8 KiB
Markdown
# OpenClaw 配置多个微信账户教程
|
||
|
||
> 来源:微信公众号「OpenClaw」
|
||
> 原文链接:https://mp.weixin.qq.com/s/obgpTeTnBoigENhneA7nWA
|
||
> 整理时间:2026-03-28
|
||
|
||
---
|
||
|
||
## 插件信息
|
||
|
||
**插件地址**:https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin
|
||
|
||
---
|
||
|
||
## 前置安装
|
||
|
||
```bash
|
||
openclaw plugins install "@tencent-weixin/openclaw-weixin"
|
||
openclaw config set 'plugins.entries["openclaw-weixin"].enabled' true --strict-json
|
||
```
|
||
|
||
---
|
||
|
||
## 配置步骤
|
||
|
||
### 第一步:分别扫码登录两个微信号
|
||
|
||
```bash
|
||
# 第一次扫码
|
||
openclaw channels login --channel openclaw-weixin
|
||
|
||
# 取出两个微信账号的 accountId
|
||
cat ~/.openclaw/openclaw-weixin/accounts.json
|
||
```
|
||
|
||
### 第二步:创建两个 Agent
|
||
|
||
```bash
|
||
openclaw agents add agent-weixin-a \
|
||
--workspace ~/.openclaw/workspace-agent-weixin-a \
|
||
--agent-dir ~/.openclaw/agents/agent-weixin-a/agent \
|
||
--non-interactive
|
||
|
||
openclaw agents add agent-weixin-b \
|
||
--workspace ~/.openclaw/workspace-agent-weixin-b \
|
||
--agent-dir ~/.openclaw/agents/agent-weixin-b/agent \
|
||
--non-interactive
|
||
```
|
||
|
||
### 第三步:配置文件
|
||
|
||
```json
|
||
{
|
||
"session": { "dmScope": "per-account-channel-peer" },
|
||
"channels": {
|
||
"openclaw-weixin": {
|
||
"defaultAccount": "账号A的accountId",
|
||
"accounts": {
|
||
"账号A的accountId": { "name": "WeChat A", "enabled": true },
|
||
"账号B的accountId": { "name": "WeChat B", "enabled": true }
|
||
}
|
||
}
|
||
},
|
||
"bindings": [
|
||
{ "agentId": "agent-weixin-a", "match": { "channel": "openclaw-weixin", "accountId": "账号A" } },
|
||
{ "agentId": "agent-weixin-b", "match": { "channel": "openclaw-weixin", "accountId": "账号B" } }
|
||
]
|
||
}
|
||
```
|
||
|
||
### 第四步:重启验证
|
||
|
||
```bash
|
||
openclaw gateway restart
|
||
openclaw agents list --bindings
|
||
openclaw channels status --probe
|
||
```
|
||
|
||
---
|
||
|
||
*本文档由欢欢助理整理*
|