乐于分享
好东西不私藏

OpenClaw 如何配置多个微信账户

OpenClaw 如何配置多个微信账户

插件地址:

https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin[1]

如何配置多 Agent

  1. 安装并启用插件
Shell
openclaw plugins install "@tencent-weixin/openclaw-weixin"openclaw config set'plugins.entries["openclaw-weixin"].enabled'true --strict-json
  1. 分别扫码登录两个微信号

第一次扫码:

Shell
openclaw channels login --channel openclaw-weixin

第二次扫码:

  1. 取出这两个微信账号的 accountId

先看插件保存的账号索引:

Shell
cat ~/.openclaw/openclaw-weixin/accounts.json

当前配置里实际账号为:

JSON
["6782910569e-im-bot","134567e95d3e0-im-bot"]
  1. 创建两个 agent
Shell
openclaw agents add agent-weixin-a \  --workspace ~/.openclaw/workspace-agent-weixin-a \  --agent-dir ~/.openclaw/agents/agent-weixin-a/agent \  --non-interactiveopenclaw agents add agent-weixin-b \  --workspace ~/.openclaw/workspace-agent-weixin-b \  --agent-dir ~/.openclaw/agents/agent-weixin-b/agent \  --non-interactive
  1. 配置文件片段
Jsonc
{// 仅保留 openclaw-weixin 多账号 / agent 路由相关配置"plugins":{// 当前完整配置里还有其他 allow 项,这里省略非相关项"entries":{"openclaw-weixin":{"enabled":true}}},"agents":{// 当前完整配置里还有 defaults 和 main,这里只保留相关 agent"list":[{"id":"agent-weixin-a","name":"agent-weixin-a","workspace":"~/.openclaw/workspace-agent-weixin-a","agentDir":"~/.openclaw/agents/agent-weixin-a/agent"},{"id":"agent-weixin-b","name":"agent-weixin-b","workspace":"~/.openclaw/workspace-agent-weixin-b","agentDir":"~/.openclaw/agents/agent-weixin-b/agent"}]},"session":{// 按「Channel账号 + 发消息用户」彻底隔离"dmScope":"per-account-channel-peer"},"channels":{"openclaw-weixin":{"defaultAccount":"6782910569e-im-bot","accounts":{"6782910569e-im-bot":{"name":"WeChat A","enabled":true},"134567e95d3e0-im-bot":{"name":"WeChat B","enabled":true}}}},"bindings":[{"agentId":"agent-weixin-a","match":{"channel":"openclaw-weixin","accountId":"6782910569e-im-bot"}},{"agentId":"agent-weixin-b","match":{"channel":"openclaw-weixin","accountId":"134567e95d3e0-im-bot"}}]}
  1. 重启并验证
Shell
openclaw gateway restartopenclaw agents list --bindingsopenclaw channels status --probe

引用链接

[1]https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin

回首页,搜索你想要的文档

在首页搜索框输入关键词,快速定位资料

文库首页搜索指引 立即搜索

相关学习资料