跳到主要内容

渠道接入

Channels 是 OpenClaw 与用户交互的通道。本章介绍如何连接 Telegram、Discord、Slack、飞书等主流通讯平台。

为什么需要渠道接入?​

OpenClaw 的核心理念是"无需安装专属客户端,直接通过日常使用的通讯软件完成交互"。这样做的好处:

  • 零学习成本:在熟悉的聊天工具中使用
  • 随时随地:手机、电脑都能访问
  • 多端同步:消息自动同步到所有设备
  • 团队协作:多人可以共享同一个 Agent

支持的平台​

OpenClaw 支持 20+ 种消息平台,按配置难度和功能完善程度分类如下:

开箱即用(核心内置)​

平台特点推荐指数
Telegram配置最简单,只需 Bot Token⭐⭐⭐⭐⭐
WebChat内置 Web 界面,本地调试首选⭐⭐⭐⭐⭐
WhatsApp用户量最大,需 QR 配对⭐⭐⭐⭐
Discord社区友好,支持服务器和频道⭐⭐⭐⭐
Slack企业集成完善,适合工作场景⭐⭐⭐⭐

通过插件安装​

平台特点安装方式
飞书/Lark中文友好,企业级插件安装
微信官方腾讯插件插件安装
Mattermost开源自托管团队协作插件安装
Microsoft Teams企业级协作平台插件安装
Matrix开源去中心化协议插件安装
LINE日本/东南亚主流 IM插件安装
Nostr去中心化社交协议插件安装
Twitch直播平台聊天插件安装
Zalo越南主流 IM插件安装
Synology Chat群晖 NAS 聊天插件安装
Nextcloud TalkNextcloud 自托管聊天插件安装
Voice Call电话语音(Plivo/Twilio)插件安装

其他内置渠道​

平台特点配置难度
BlueBubbles推荐 iMessage 方案,功能完善中等
Signal隐私优先,通过 signal-cli中等
IRC经典 IRC 协议简单
Google ChatGoogle Workspace 集成中等
QQ BotQQ 官方机器人 API中等

Telegram 接入​

创建 Telegram Bot​

  1. 在 Telegram 中搜索 @BotFather
  2. 发送 /newbot 创建新机器人
  3. 按提示设置机器人名称
  4. 获取 Bot Token(格式:123456789:ABCdefGHIjklMNOpqrsTUVwxyz)

配置 OpenClaw​

# 添加 Telegram 渠道(交互式)
openclaw channels add --channel telegram

# 非交互式配置
openclaw channels add --channel telegram --token YOUR_BOT_TOKEN

# 验证连接
openclaw channels status --probe

配置示例​

{
"channels": {
"telegram": {
"enabled": true,
"accounts": {
"default": {
"botToken": "YOUR_BOT_TOKEN"
}
},
"dmPolicy": "pairing",
"allowFrom": []
}
}
}

Discord 接入​

创建 Discord Bot​

  1. 访问 Discord Developer Portal
  2. 点击"New Application"创建应用
  3. 进入"Bot"页面,点击"Add Bot"
  4. 获取 Bot Token
  5. 在"OAuth2"页面生成邀请链接,添加 Bot 到服务器

配置 OpenClaw​

# 添加 Discord 渠道
openclaw channels add --channel discord

# 非交互式
openclaw channels add --channel discord --token YOUR_BOT_TOKEN

# 验证连接
openclaw channels status --probe

权限设置​

确保 Bot 有以下权限:

  • Send Messages
  • Read Message History
  • Embed Links
  • Attach Files

配置示例​

{
"channels": {
"discord": {
"enabled": true,
"accounts": {
"default": {
"token": "YOUR_BOT_TOKEN"
}
}
}
}
}

Slack 接入​

创建 Slack App​

  1. 访问 Slack API
  2. 点击"Create New App"
  3. 选择"From scratch",输入 App 名称
  4. 进入"OAuth & Permissions",添加以下权限:
    • chat:write
    • channels:history
    • groups:history
    • im:history
  5. 安装 App 到工作区,获取 Bot User OAuth Token

配置 OpenClaw​

# 添加 Slack 渠道
openclaw channels add --channel slack

# 验证连接
openclaw channels status --probe

配置示例​

{
"channels": {
"slack": {
"enabled": true,
"accounts": {
"default": {
"botToken": "xoxb-YOUR-BOT-TOKEN",
"appToken": "xapp-YOUR-APP-TOKEN"
}
}
}
}
}

飞书接入​

创建飞书机器人​

  1. 访问 飞书开放平台
  2. 创建企业自建应用
  3. 在"凭证与基础信息"获取 App ID 和 App Secret
  4. 在"权限管理"开通以下权限:
    • im:message(获取与发送消息)
    • im:message:send_as_bot(以应用身份发消息)
  5. 发布应用并添加到群组

配置 OpenClaw​

飞书渠道需要通过插件安装:

# 安装飞书插件
openclaw plugins install @openclaw/plugin-feishu

# 配置飞书渠道
openclaw channels add feishu --app-id YOUR_APP_ID --app-secret YOUR_APP_SECRET

配置事件订阅​

在飞书应用后台配置事件订阅:

  • 请求地址:https://your-server/webhook/feishu
  • 订阅事件:im.message.receive_v1

配置示例​

{
"channels": {
"feishu": {
"enabled": true,
"appId": "YOUR_APP_ID",
"appSecret": "YOUR_APP_SECRET",
"encryptKey": "YOUR_ENCRYPT_KEY",
"verificationToken": "YOUR_VERIFICATION_TOKEN"
}
}
}

iMessage 接入(BlueBubbles)​

官方推荐使用 BlueBubbles 作为 iMessage 接入方案,功能完善支持编辑、撤回、效果、反应和群组管理。

前提条件​

  • macOS 设备一台
  • 安装 BlueBubbles 服务端

配置步骤​

  1. 在 macOS 上安装并配置 BlueBubbles 服务端
  2. 获取 BlueBubbles 服务器 URL 和密码
  3. 配置 OpenClaw:
{
"channels": {
"bluebubbles": {
"enabled": true,
"serverUrl": "https://your-bluebubbles-server",
"password": "YOUR_PASSWORD"
}
}
}

功能支持​

BlueBubbles 提供完整的 iMessage 功能支持:

  • 发送和接收消息
  • 编辑和撤回消息
  • 消息效果和反应
  • 群组管理
  • 图片和附件

注意:macOS 26 Tahoe 上编辑功能目前存在问题。

微信接入​

微信渠道通过官方腾讯插件实现,支持私聊场景。

安装插件​

# 安装微信插件
openclaw plugins install @openclaw/plugin-wechat

配置和登录​

# 添加微信渠道
openclaw channels add wechat

# 扫描 QR 码登录
openclaw channels login --channel wechat

限制说明​

微信渠道目前仅支持私聊,不支持群聊。

Web UI​

Web UI 是 OpenClaw 自带的 Web 界面,功能最完整。

启动 Web UI​

# 启动 Gateway(包含 Web UI)
openclaw gateway start

# 访问 Web UI
# http://127.0.0.1:18789

配置参数​

# 设置端口
openclaw config set gateway.port 18789

# 设置访问 Token
openclaw config set gateway.token YOUR_TOKEN

# 启用/禁用 Web UI
openclaw config set gateway.webui.enabled true

远程访问​

如果 OpenClaw 部署在远程服务器,需要建立 SSH 端口转发:

# 在本地电脑执行
ssh -N -L 18789:127.0.0.1:18789 user@server-ip

然后访问 http://127.0.0.1:18789。

Signal 接入​

Signal 渠道通过 signal-cli 实现,注重隐私保护。

配置 OpenClaw​

# 添加 Signal 渠道
openclaw channels add --channel signal

# 注册或登录
openclaw channels login --channel signal

配置示例​

{
"channels": {
"signal": {
"enabled": true,
"phoneNumber": "+15555550123"
}
}
}

QQ Bot 接入​

QQ Bot 是腾讯官方机器人 API,支持私聊和群聊。

创建 QQ Bot​

  1. 访问 QQ 开放平台
  2. 创建机器人应用
  3. 获取 App ID 和 App Token

配置 OpenClaw​

{
"channels": {
"qq": {
"enabled": true,
"appId": "YOUR_APP_ID",
"appToken": "YOUR_APP_TOKEN"
}
}
}

Google Chat 接入​

Google Chat 适合使用 Google Workspace 的团队。

创建 Google Chat 应用​

  1. 访问 Google Cloud Console
  2. 创建项目并启用 Google Chat API
  3. 配置 HTTP 端点
  4. 获取服务账号凭证

配置 OpenClaw​

{
"channels": {
"googlechat": {
"enabled": true,
"credentials": {
"projectId": "YOUR_PROJECT_ID",
"clientEmail": "YOUR_SERVICE_ACCOUNT",
"privateKey": "YOUR_PRIVATE_KEY"
}
}
}
}

多渠道管理​

查看所有渠道​

# 查看已配置的渠道
openclaw channels list

# 查看渠道详情
openclaw channels info telegram

# 查看使用量(需要 OAuth/API 凭证)
openclaw channels list --usage

启用/禁用渠道​

# 启用渠道
openclaw channels enable telegram

# 禁用渠道
openclaw channels disable telegram

测试渠道连接​

# 测试所有渠道
openclaw channels status --probe

# 测试特定渠道
openclaw channels status telegram --probe

# 发送测试消息
openclaw channels test telegram --message "测试消息"

移除渠道​

# 禁用渠道(保留配置)
openclaw channels remove telegram

# 完全删除渠道配置
openclaw channels remove telegram --delete

插件渠道安装​

部分渠道需要通过插件安装。插件安装方法:

# 列出可用插件
openclaw plugins list

# 安装插件
openclaw plugins install @openclaw/plugin-feishu
openclaw plugins install @openclaw/plugin-wechat
openclaw plugins install @openclaw/plugin-matrix
openclaw plugins install @openclaw/plugin-mattermost
openclaw plugins install @openclaw/plugin-msteams
openclaw plugins install @openclaw/plugin-line
openclaw plugins install @openclaw/plugin-nostr
openclaw plugins install @openclaw/plugin-twitch
openclaw plugins install @openclaw/plugin-zalo

# 启用插件
openclaw plugins enable feishu

# 禁用插件
openclaw plugins disable feishu

消息路由​

路由规则​

可以为不同渠道设置不同的处理规则:

{
"routing": {
"rules": [
{
"channel": "telegram",
"agent": "personal-assistant"
},
{
"channel": "slack",
"agent": "work-assistant"
},
{
"channel": "feishu",
"keywords": ["紧急", "urgent"],
"priority": "high"
}
]
}
}

多 Bot 配置​

可以为不同群组配置不同的 Bot:

{
"channels": {
"telegram": {
"bots": [
{
"name": "work-bot",
"token": "WORK_BOT_TOKEN",
"allowedChats": ["WORK_CHAT_ID"]
},
{
"name": "personal-bot",
"token": "PERSONAL_BOT_TOKEN",
"allowedChats": ["PERSONAL_CHAT_ID"]
}
]
}
}
}

安全配置​

访问控制​

限制谁可以使用你的 Agent:

{
"channels": {
"telegram": {
"allowedUsers": ["USER_ID_1", "USER_ID_2"],
"allowedChats": ["CHAT_ID_1", "CHAT_ID_2"]
}
}
}

消息过滤​

过滤敏感信息:

{
"channels": {
"telegram": {
"messageFilter": {
"blockPatterns": ["password", "secret", "token"],
"maxMessageLength": 4096
}
}
}
}

速率限制​

防止滥用:

{
"channels": {
"telegram": {
"rateLimit": {
"maxRequests": 100,
"windowMs": 60000
}
}
}
}

常见问题​

Telegram Bot 无响应​

检查清单:

  1. Bot Token 是否正确
  2. Bot 是否被添加到群组
  3. 是否设置了 allowedChats 限制
  4. 查看日志:openclaw channels logs telegram

Discord Bot 权限不足​

解决:

  1. 检查 Bot 角色权限
  2. 确保 Bot 有"Send Messages"权限
  3. 重新邀请 Bot 到服务器

飞书消息收不到​

检查:

  1. 应用是否已发布
  2. 事件订阅是否配置正确
  3. 权限是否已开通
  4. Encrypt Key 是否正确

WhatsApp 配对失败​

解决:

  1. 确保手机网络正常
  2. 清除旧的配对数据:openclaw channels logout --channel whatsapp
  3. 重新扫码配对:openclaw channels login --channel whatsapp

插件渠道不显示​

检查:

  1. 插件是否安装:openclaw plugins list
  2. 插件是否启用:openclaw plugins enable <plugin-id>
  3. 检查插件状态:openclaw plugins doctor

Web UI 无法访问​

解决:

# 检查服务状态
openclaw gateway status

# 检查端口是否被占用
lsof -i :18789

# 重启服务
openclaw gateway restart

BlueBubbles 连接失败​

检查:

  1. BlueBubbles 服务端是否正常运行
  2. 服务器 URL 是否可访问
  3. 密码是否正确
  4. 检查 macOS 防火墙设置

下一步​