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

资源链接

相关推荐
xixingzhe24 小时前
AI 自然语言转SQL
人工智能
love530love4 小时前
【笔记】AutoClaw NSIS 安装器卡死、进程杀不掉、目录删不了?我是这么解决的
人工智能·windows·笔记·agent
Mandy的名字被占用了4 小时前
晨风AI+知识付费系统|学练考全闭环,重构教育变现新模式
人工智能·后端
步步为营DotNet4 小时前
Avalonia 11.3 本地离线AI图像识别绑定Minimal API AI推理网关
人工智能
满怀冰雪5 小时前
06-自动微分入门:用 Paddle 计算梯度
人工智能·python·深度学习·paddle
架构源启5 小时前
文档接入与智能解析:基于 Spring AI 1.1.x 的多格式解析、版面理解与结构化抽取
java·人工智能·spring
李昊哲小课5 小时前
GLM 多技术栈集成完整教程
人工智能·智能体
浩哥学JavaAI6 小时前
2026年最新AI agent面试(10)_通信与行业动态
人工智能·面试·职场和发展
新知图书6 小时前
7.4 测试与发布(一键生成PPT智能体开发)
人工智能·agent·ai agent·智能体·扣子
糖果店的幽灵6 小时前
【langgraph 从入门到精通graphApi 篇】Checkpoint 持久化与状态管理
人工智能·langgraph