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       │
└───────────────┘     └───────────────┘     └───────────────┘

资源链接

相关推荐
Slow菜鸟2 小时前
AI学习篇(三) | AI效率工具指南(2026年)
人工智能·学习
北京软秦科技有限公司2 小时前
AI审核如何助力合规取证?IACheck打造环境检测报告电子存证与法律风险防控新路径
大数据·人工智能
蜘蛛侠..2 小时前
Skills 和 Prompt、MCP、Function Calling 有什么区别?
ai·prompt·agent·skill·functioncalling·mcp·skills
qq_359716232 小时前
openpi使用过程中相关问题
人工智能·深度学习·机器学习
minhuan3 小时前
医疗AI智能体:从数据到关怀人文设计:告别冰冷精准,构建有温度的诊疗交互.131
人工智能·ai智能体·智能体的人文设计·医疗ai人文设计·构建医疗ai智能体
Promise微笑3 小时前
驾驭AI引用:Geo优化中的内容评分机制与实战策略深度解析
人工智能
忆想不到的晖4 小时前
Codex 探索:别急着调 Prompt,先把工作流收住
后端·agent·ai编程
ai生成式引擎优化技术4 小时前
全球唯一四元结构底层架构问世:TSPR-WEB-LLM-HIC v2.0 终结大模型投毒与幻觉的终极技术范式
人工智能
听你说324 小时前
伊萨推出 ROBBI 360 协作机器人焊接工作站 简化自动化焊接部署流程
人工智能·机器人·自动化