OpenClaw Agent-Channel 配置技术指南

1. Channel 配置多个账户信息

通过配置 accounts配置多个账户,后续通过绑定account_id来关联,account_id不能重复

编辑 .openclaw/openclaw.json文件,修改channels节点

1.1 Telegram

1
2
3
4
5
6
7
8
9
10
11
12
13
14
"channels": {
"telegram": {
"accounts": {
"account_id1": {
"botToken": "xxxx"
},
"account_id2": {
"botToken": "yyyy"
}
},
"groupPolicy": "allowlist",
"allowFrom": ["+1 XXXXXXXXXX"] // 白名单
}
}

1.2 Feishu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"feishu": {
"accounts": {
"账户1定义id": {
"enabled": true,
"appId": "xxx",
"appSecret": "xxxx",
"botName": "学习助手",
"connectionMode": "websocket",
"domain": "feishu",
"groupPolicy": "allowlist"
},
"账户2定义id": {
"enabled": true,
"appId": "yyy",
"appSecret": "yyy",
"botName": "学习助手",
"connectionMode": "websocket",
"domain": "feishu",
"groupPolicy": "allowlist"
}
}
}

2. 建立agent和channel的绑定关系

1
2
# 1. 新增绑定规则
openclaw agents bind --agent <agent_id> --bind <channel>:<channel_account_id>
  • agent_id: agentID,可以通过openclaw agents list 获取
  • channel: channel的名称,例如 telegram
  • channel_account_id: 在上一步

3. 重启gateway

1
openclaw gateway restart

4、启用机器人

进入机器人聊天窗口,重新发送一个消息,此时OpenClaw应该会让我们进行配对:

1
2
3
4
5
6
7
8
OpenClaw: access not configured.

Your Telegram user id: xxxx

Pairing code: yyy

Ask the bot owner to approve with:
openclaw pairing approve telegram yyy

在终端下执行 pairing approve进行授权绑定

1
openclaw pairing approve telegram yyy