OpenClaw 完全指南:多渠道 AI Agent 网关

🦞 "EXFOLIATE! EXFOLIATE!" --- 一只太空龙虾

简介

OpenClaw 是一个强大的多渠道 AI Agent 网关,让你的 AI 助手能够跨 WhatsApp、Telegram、Discord、iMessage 等多个聊天平台运行。通过单一的 Gateway 进程,实现消息收发、媒体处理、多 Agent 路由等功能。


核心特性

📱 多渠道支持

平台 说明
WhatsApp 通过 WhatsApp Web (Baileys) 集成
Telegram Bot 支持 (grammY)
Discord Bot 支持
iMessage macOS 本地 imsg CLI 集成
Slack 完整 Bot 支持
Signal 支持
Google Chat 支持
MS Teams 支持
Mattermost 插件扩展
Matrix 支持
Feishu 飞书支持
LINE 支持
Nostr 去中心化协议支持

🤖 多 Agent 路由

  • 独立会话隔离(按工作区或发送者)
  • 主会话 + 子 Agent 并行运行
  • 后台任务处理

🖼️ 媒体支持

  • 图片收发
  • 音频处理
  • 文档传输
  • 语音转文字(可选 Hook)

🌐 多种访问方式

  • Web Control UI: 浏览器控制面板
  • macOS App: 菜单栏应用
  • iOS/Android Node: 移动端节点配对
  • CLI: 完整命令行工具
  • TUI: 终端用户界面

安装与快速开始

安装

复制代码
npm install -g openclaw@latest

初始化配置

复制代码
# 运行引导式配置向导
openclaw onboard --install-daemon

启动 Gateway

复制代码
# 配置频道
openclaw channels login

# 启动网关
openclaw gateway --port 18789

打开控制面板


CLI 命令大全

全局参数

复制代码
openclaw [--dev] [--profile <name>] <command>
参数 说明
--dev 开发模式,状态存储在 ~/.openclaw-dev
--profile <name> 使用独立配置
--no-color 禁用彩色输出
--json JSON 格式输出

Gateway 网关命令

复制代码
# 运行网关
openclaw gateway

# 查看状态
openclaw gateway status

# 服务管理
openclaw gateway install    # 安装为系统服务
openclaw gateway start      # 启动服务
openclaw gateway stop       # 停止服务
openclaw gateway restart    # 重启服务
openclaw gateway uninstall  # 卸载服务

# 健康检查
openclaw gateway health
openclaw gateway probe      # 深度探测

# 发现局域网网关
openclaw gateway discover

Gateway 参数:

参数 说明
--port <port> WebSocket 端口(默认 18789)
--bind <mode> 绑定模式:loopback/lan/tailnet/auto
--token <token> 认证令牌
--password <password> 密码认证
--tailscale <mode> Tailscale 暴露:off/serve/funnel

Channels 频道命令

复制代码
# 列出所有频道
openclaw channels list

# 查看状态
openclaw channels status

# 添加频道账号
openclaw channels add --channel telegram --token <bot-token>
openclaw channels add --channel discord --token <bot-token>

# 登录/登出
openclaw channels login --channel whatsapp
openclaw channels logout --channel whatsapp

# 查看日志
openclaw channels logs --channel all

# 查看能力
openclaw channels capabilities

支持的频道:

  • whatsapp / telegram / discord / slack / signal
  • googlechat / msteams / imessage / mattermost

Message 消息命令

复制代码
# 发送消息
openclaw message send --channel telegram --target @username --message "Hello!"

# 发送 Discord 消息
openclaw message send --channel discord --target channel:123 --message "Hi"

# 创建投票
openclaw message poll --channel discord \
  --target channel:123 \
  --poll-question "选择哪个?" \
  --poll-option Pizza \
  --poll-option Sushi

# 消息反应
openclaw message react --channel slack \
  --target C123 --message-id 456 --emoji "✅"

# 编辑/删除
openclaw message edit --channel discord --target channel:123 --message-id 456 --message "新内容"
openclaw message delete --channel discord --target channel:123 --message-id 456

# 置顶/取消置顶
openclaw message pin --channel discord --target channel:123 --message-id 456
openclaw message unpin --channel discord --target channel:123 --message-id 456

# 群发消息
openclaw message broadcast --channel telegram --targets @user1 --targets @user2 --message "公告"

Cron 定时任务

复制代码
# 查看定时任务状态
openclaw cron status

# 列出所有任务
openclaw cron list

# 添加一次性任务(5分钟后提醒)
openclaw cron add \
  --name "提醒喝水" \
  --at "5m" \
  --session isolated \
  --message "💧 该喝水啦!" \
  --deliver \
  --channel telegram \
  --to "123456789" \
  --delete-after-run

# 添加周期性任务(每天早上8点)
openclaw cron add \
  --name "早安提醒" \
  --cron "0 8 * * *" \
  --tz "Asia/Shanghai" \
  --session isolated \
  --message "早安!新的一天开始了 ☀️" \
  --deliver

# 编辑/删除任务
openclaw cron edit <job-id> --message "新消息"
openclaw cron rm <job-id>

# 启用/禁用
openclaw cron enable <job-id>
openclaw cron disable <job-id>

# 立即运行
openclaw cron run <job-id>

时间格式:

  • 相对时间: 5m(5分钟)、1h(1小时)、2d(2天)
  • 绝对时间: 2026-03-06T14:00:00+08:00
  • Cron 表达式: 0 8 * * *

Nodes 节点命令

复制代码
# 列出已配对节点
openclaw nodes list
openclaw nodes list --connected

# 查看待审批请求
openclaw nodes pending
openclaw nodes approve <requestId>

# 在节点上执行命令
openclaw nodes run --node <id> --raw "ls -la"

# 发送通知
openclaw nodes notify --node <id> --title "提醒" --body "任务完成"

# 拍照
openclaw nodes camera snap --node <id> --facing back

# 录屏
openclaw nodes screen record --node <id> --duration 10s

# 获取位置
openclaw nodes location get --node <id>

# Canvas 操作
openclaw nodes canvas snapshot --node <id>
openclaw nodes canvas present --node <id> --target https://example.com

Browser 浏览器控制

复制代码
# 状态与启动
openclaw browser status
openclaw browser start
openclaw browser stop

# 打开页面
openclaw browser open https://example.com

# 截图
openclaw browser screenshot --full-page

# 快照
openclaw browser snapshot

# 页面操作
openclaw browser click <ref>
openclaw browser type <ref> "Hello"
openclaw browser press Enter
openclaw browser hover <ref>

# 导航
openclaw browser navigate https://google.com

Sessions 会话命令

复制代码
# 列出会话
openclaw sessions
openclaw sessions --active 120

# 查看状态
openclaw status
openclaw status --deep
openclaw status --usage

Agents Agent 管理

复制代码
# 列出 Agent
openclaw agents list

# 添加独立 Agent
openclaw agents add my-agent --workspace ./my-workspace --model claude-3-opus

# 删除 Agent
openclaw agents delete <id>

Models 模型命令

复制代码
# 列出可用模型
openclaw models list

# 查看状态
openclaw models status

# 设置默认模型
openclaw models set claude-3-opus
openclaw models set-image claude-3-opus

# 模型别名
openclaw models aliases add opus claude-3-opus
openclaw models aliases list

# 认证
openclaw models auth setup-token --provider anthropic

Memory 记忆管理

复制代码
# 查看状态
openclaw memory status

# 建立索引
openclaw memory index

# 语义搜索
openclaw memory search "项目名称"

Skills 技能管理

复制代码
# 列出技能
openclaw skills list

# 查看技能详情
openclaw skills info <name>

# 检查技能就绪状态
openclaw skills check

Plugins 插件管理

复制代码
# 列出插件
openclaw plugins list

# 安装插件
openclaw plugins install <path|.tgz|npm-spec>

# 启用/禁用
openclaw plugins enable <id>
openclaw plugins disable <id>

其他实用命令

复制代码
# 诊断
openclaw doctor

# 安全审计
openclaw security audit

# 更新
openclaw update

# 日志
openclaw logs --follow

# 配置
openclaw config get <path>
openclaw config set <path> <value>
openclaw config unset <path>

# 重置
openclaw reset --scope config

# 卸载
openclaw uninstall --all

配置示例

配置文件位于 ~/.openclaw/openclaw.json

复制代码
{
  channels: {
    whatsapp: {
      allowFrom: ["+15555550123"],
      groups: { "*": { requireMention: true } },
    },
  },
  messages: { 
    groupChat: { mentionPatterns: ["@openclaw"] } 
  },
  gateway: {
    mode: "local",
    port: 18789
  }
}

架构图

复制代码
┌─────────────────────────────────────────────────────────────┐
│                    Chat Apps + Plugins                      │
│   WhatsApp | Telegram | Discord | iMessage | Slack | ...   │
└─────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                        Gateway                              │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐       │
│  │ Sessions │ │ Channels │ │  Nodes   │ │  Hooks   │       │
│  └──────────┘ └──────────┘ └──────────┘ └──────────┘       │
└─────────────────────────────────────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        ▼                     ▼                     ▼
┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│   Pi Agent    │     │     CLI       │     │  Web UI       │
└───────────────┘     └───────────────┘     └───────────────┘

资源链接

相关推荐
安逸sgr3 小时前
16-OpenClaw数据分析与可视化
人工智能·数据挖掘·数据分析·大模型·aigc·agent·openclaw
weiyvyy3 小时前
无人机嵌入式开发实战-安全机制与应急处理
人工智能·嵌入式硬件·安全·机器人·游戏引擎·无人机·信息化
GEO_Huang3 小时前
广佛莞深RPA定制,数谷智能科技让软件操控自动化?
大数据·人工智能·aigc·rpa·geo
你的论文学长3 小时前
【架构拆解】从 RAG 检索到全局 Linting:如何用工程化思维跑通几万字的自动化写作流?
运维·人工智能·安全·自然语言处理·架构·自动化·ai写作
xiaogutou11213 小时前
英语课件ppt一键生成实战:公开课、日常课的不同工具选择
人工智能
weiyvyy3 小时前
机械臂控制开发实战-机械臂控制系统架构
人工智能·嵌入式硬件·机器学习·架构·机器人·需求分析·嵌入式实时数据库
minhuan3 小时前
大模型应用:搜索的智能革命:大模型如何重塑传统搜索算法构建新一代智能检索.110
人工智能·搜索引擎·大模型应用·智能搜索实践
wuxi_joe3 小时前
企业 AI 专家系统架构
人工智能
羊羊小栈3 小时前
基于「YOLO目标检测 + 多模态AI分析」的植物番茄病害检测分析系统
人工智能·yolo·目标检测·计算机视觉·毕业设计·大作业