@lansenger/openclaw-channel-lansenger
v1.1.32
Published
蓝信机器人插件 - 让 AI 助手接入蓝信,无需服务器 | Lanxin channel plugin for OpenClaw
Readme
Lansenger (蓝信) 通道插件 for OpenClaw
通过 WebSocket 长连接连接 Lansenger 机器人。
功能特性
- WebSocket 长连接实现实时消息传递
- 多账号支持
- 不同机器人的路由管理
- 基于会话的隔离
OpenClaw 版本兼容性说明
OpenClaw 从 2026.4.x 升级到 2026.5.x 后,channels add 等 CLI 命令的 channel 发现机制发生了变更,对插件造成了以下影响:
影响说明
| 变化 | 影响 | 说明 |
| -------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| channel 发现范围缩小 | channels add 命令不再自动扫描 npm 安装的插件 | 通过 openclaw plugins install 安装的插件无法被 channels add 命令发现,会报错 Unknown channel: Lansenger |
| 需手动准备插件路径 | 插件需要放在 extensions/ 目录才能被 CLI 命令识别 | 将 npm 安装的插件文件复制到 extensions/openclaw-lansenger/ 目录即可 |
| Plugin SDK 变化 | OpenClaw plugin SDK not found, using fallback 为正常提示 | 不影响功能,插件使用内置 fallback 机制正常运行 |
受影响的命令
openclaw channels add --channel Lansenger— 需先将插件放入 extensions 目录openclaw channels update— 同上openclaw plugins install— 正常,但安装后需手动复制到 extensions
当前解决方案
# 1. 安装插件
openclaw plugins install @lansenger/openclaw-channel-lansenger
# 2. 复制到 extensions 目录(解决 CLI 命令无法发现插件的问题)
cp -r ~/.openclaw/npm/node_modules/@lansenger/openclaw-channel-lansenger/* \
~/.openclaw/extensions/openclaw-lansenger/
# 3. 重启网关使配置加载
openclaw gateway restart
# 4. 现在可以正常使用 channels add 命令
openclaw channels add --channel Lansenger --token "AppID:AppSecret:APIGateway"此问题是 OpenClaw 上游 bug,非插件本身问题。相关 Issue 模板已提供在插件日志目录中。
安装
通过 OpenClaw CLI 安装(推荐)
# 安装 Lansenger 通道插件
openclaw plugins install @lansenger/openclaw-channel-lansenger使用
添加 AppId 命令
您可以使用命令行添加 Lansenger 机器人账号:
openclaw channels add --channel Lansenger --token "{AppID}:{AppSecret}:{APIGateway}"参数说明:
--channel Lansenger:指定通道名称为 Lansenger--token:包含以下信息的令牌(使用:分隔字段){AppID}:蓝信机器人的 AppID{AppSecret}:蓝信机器人的 AppSecret{APIGateway}:(可选) 蓝信 API 网关地址,支持 https/http 协议
使用示例:
# 基本格式
openclaw channels add --channel Lansenger --token "123123-123123:ABHCDEFE"
# 指定 API 网关地址
openclaw channels add --channel Lansenger --token "123123-123123:ABHCDEFE:https://gateway.cn"此命令将:
- 解析令牌并提取 AppID、AppSecret、API 网关地址
- 在配置文件中自动添加或更新账号信息
- 自动启用 Lansenger 通道
注意:使用此命令后,无需手动修改 openclaw.json 配置文件,系统会自动处理所有配置。
通过 OpenClaw Dashboard 修改配置
您也可以通过 OpenClaw 的 Web 管理界面(Dashboard)来管理蓝信插件配置:
# 启动 OpenClaw 网关
openclaw gateway start
# 打开 Dashboard(默认地址)
openclaw dashboard
# 或在浏览器中访问: http://localhost:18789在 Dashboard 中配置蓝信插件:
- 登录 Dashboard 后,点击左侧菜单的 Channels
- 在通道列表中找到 Lansenger,点击进入
- 选择要修改的账号,或点击 Add Account 添加新账号
- 在配置表单中修改各项设置(如 appId、appSecret、群聊设置等)
- 点击 Save 保存配置
支持在 Dashboard 中修改的配置项:
- App ID 和 App Secret
- API 网关地址
- 群聊响应策略(ownerOnly/atMe/all)
- 是否响应 @全体成员消息
- 上下文消息条数
- 高危操作审批设置
命令无法使用时的手动配置
重要提示:如果执行 openclaw channels add --channel Lansenger 命令时出现 Unknown channel: Lansenger 错误,这是因为当前 OpenClaw 版本的 bug(npm 安装的插件无法被 channels add 命令发现)。此时需要手动配置 OpenClaw。
临时解决方案
将插件源码手动复制到 extensions 目录:
cp -r ~/.openclaw/npm/node_modules/@lansenger/openclaw-channel-lansenger/* \
~/.openclaw/extensions/openclaw-lansenger/再执行:
openclaw channels add --channel Lansenger --token "123123-123123:ABHCDEFE:https://gateway.cn"如执行命令时出现 Unknown channel: Lansenger 错误,需要手动编辑配置文件
手动编辑配置文件
如果您需要手动配置,请按照以下格式编辑 ~/.openclaw/openclaw.json 文件:
1. 添加插件配置
在 plugins 部分添加:
{
"plugins": {
"enabled": true,
"allow": [
"openclaw-channel-lansenger"
],
"entries": {
"openclaw-channel-lansenger": {
"enabled": true
}
},
"bundledDiscovery": "compat"
}
}2. 添加通道配置
在 channels 部分添加:
{
"channels": {
"Lansenger": {
"enabled": true,
"accounts": {
"default": {
"enabled": true,
"appId": "your-app-id-here",
"appSecret": "your-app-secret-here",
"apiGatewayUrl": "https://your-api-gateway.com",
"approval": {
"enabled": true,
"highRiskTools": "write,delete,trash,rm"
}
}
}
}
}
}如需Agent隔离功能,需在bindings中添加配置:
"bindings": [
{
"type": "route",
"agentId": "coder",
"match": { "channel": "Lansenger", "accountId": "bot_15294464" }
},
{
"type": "route",
"agentId": "friend",
"match": { "channel": "Lansenger", "accountId": "bot_11100160" }
}
]3. 配置参数说明
| 参数 | 说明 | 示例值 |
| ------------------------ | ---------------- | ------------------------------ |
| appId | 蓝信机器人的 AppID | 123456-789012 |
| appSecret | 蓝信机器人的 AppSecret | ABCDEF123456789 |
| apiGatewayUrl | 蓝信 API 网关地址 | https://apigw.lx.qianxin.com |
| approval.enabled | 是否开启高危操作审批 | true 或 false |
| approval.highRiskTools | 高危操作工具列表(逗号分隔) | write,delete,trash,rm |
4. 环境变量配置(推荐)
插件支持通过环境变量配置凭证,优先级高于配置文件:
| 环境变量 | 说明 | 示例值 |
| ---------------------- | ---------------- | ----------------- |
| LANSENGER_APP_ID | 蓝信机器人的 AppID | 123456-789012 |
| LANSENGER_APP_SECRET | 蓝信机器人的 AppSecret | ABCDEF123456789 |
使用示例:
# 设置环境变量
export LANSENGER_APP_ID="123456-789012"
export LANSENGER_APP_SECRET="ABCDEF123456789"
# 启动 OpenClaw
openclaw gateway start注意:环境变量配置仅适用于单账号场景。如需多账号管理,请使用配置文件方式。
5. 重启 OpenClaw
配置完成后,重启 OpenClaw 使配置生效:
openclaw gateway restartAgent 隔离功能
Lansenger 插件支持每个 appId 与单独的 agent 绑定,实现独立的通信和会话管理:
实现效果:
- 不同的蓝信机器人(appId)可以绑定到不同的 OpenClaw agent
- 每个 agent 拥有独立的会话上下文和工作区
- 消息会自动路由到对应绑定的 agent
- 支持多机器人同时运行,互不干扰
配置方式:
- 添加多个账号:
openclaw channels add --channel Lansenger --token "{AppID}:{AppSecret}:{APIGateway}" - 在
openclaw.json的绑定配置中设置 agentId:"bindings": [ { "type": "route", "agentId": "coder", "match": { "channel": "Lansenger", "accountId": "bot_xxx" } } ]
系统会自动在配置文件中生成绑定关系:
"bindings": [
{
"type": "route",
"agentId": "coder",
"match": { "channel": "Lansenger", "accountId": "bot_15294464" }
},
{
"type": "route",
"agentId": "friend",
"match": { "channel": "Lansenger", "accountId": "bot_11100160" }
}
]使用示例:
- 机器人 A (appId: your-app-id-1) 绑定到 agent: friend
- 机器人 B (appId: your-app-id-2) 绑定到 agent: coder
- 两个机器人可以同时运行,拥有独立的会话和上下文
配置文件完整示例
以下是一个完整的 OpenClaw 配置文件示例,包含 Lansenger 插件的配置:
{
"plugins": {
"enabled": true,
"allow": [
"memory-core",
"openclaw-channel-lansenger"
],
"load": {
"paths": [
"~/.openclaw/extensions"
]
},
"entries": {
"openclaw-channel-lansenger": {
"enabled": true
}
},
"bundledDiscovery": "compat"
},
"channels": {
"telegram": {
"enabled": true
},
"Lansenger": {
"enabled": true,
"accounts": {
"default": {
"enabled": true,
"appId": "2285568-8700160",
"appSecret": "FD42BF3227A03AA22AC621829AD2711C",
"apiGatewayUrl": "https://apigw.lx.qianxin.com",
"approval": {
"enabled": true,
"highRiskTools": "write,delete,trash,rm"
}
},
"bot_8700160": {
"enabled": true,
"appId": "2285568-8700160",
"appSecret": "FD42BF3227A03AA22AC621829AD2711C",
"apiGatewayUrl": "https://apigw.lx.qianxin.com",
"agentId": "coder",
"approval": {
"enabled": true,
"highRiskTools": "write,delete,trash,rm"
}
}
}
}
},
"bindings": [
{
"type": "route",
"agentId": "coder",
"match": { "channel": "Lansenger", "accountId": "bot_8700160" }
}
]
}故障排除
会话隔离
如果您遇到会话隔离问题,请确保:
- 您已在 OpenClaw 配置中正确配置了绑定
- 每个机器人在配置中使用不同的 accountId
- 每个 agent 有自己的工作区
消息路由
如果消息没有路由到正确的 agent:
- 检查您的绑定配置
- 确保绑定中的 accountId 与通道配置中的 accountId 匹配
- 更改配置后重启 OpenClaw
channels add 命令报错 "Unknown channel: Lansenger"
问题描述:执行 openclaw channels add --channel Lansenger 命令时出现错误。
原因:这是 OpenClaw 当前版本的已知 bug。通过 openclaw plugins install 从 npm 安装的插件无法被 channels add 命令发现。
解决方案:
- 临时方案(推荐):将插件手动复制到 extensions 目录
cp -r ~/.openclaw/npm/node_modules/@lansenger/openclaw-channel-lansenger/* \ ~/.openclaw/extensions/openclaw-lansenger/ openclaw gateway restart - 手动配置:参考上方的"手动编辑配置文件"章节,直接编辑
openclaw.json - 长期方案:向 OpenClaw 官方提交 Issue,等待 bug 修复。
速率限制问题
如果在安装过程中遇到 Rate limit exceeded 错误:
- 在短暂延迟后尝试重新安装插件
- 如果需要,重复安装过程几次
- 速率限制通常是临时的,应该在几分钟内解决
日志
日志可在 OpenClaw 日志目录中找到。查找带有 [Lansenger] 前缀的日志。
