OpenClaw 入门教程
第一章:初识 OpenClaw
1.1 什么是 OpenClaw
OpenClaw(中文版:openclaw-cn)是一款现代化的自动化助手平台,它将多种消息渠道、AI助手和自动化工具集成在一起。你可以把它理解为:
🤖 你的个人AI助理
📱 多渠道消息管理器
⚡ 自动化任务执行器
🔧 可扩展的平台
1.2 核心组件
┌─────────────────────────────────────┐
│ 网关 Gateway │ ← 核心服务,处理所有通信
├─────────────────────────────────────┤
│ 智能体 Agent │ ← AI助手,执行各种任务
├─────────────────────────────────────┤
│ 渠道 Channels │ ← 消息平台(WhatsApp、Telegram等)
├─────────────────────────────────────┤
│ 技能 Skills │ ← 扩展功能模块
└─────────────────────────────────────┘第二章:快速开始
2.1 安装验证
# 检查是否安装成功
openclaw-cn --version
# 应显示类似:🦞 Clawdbot-CN 2026.1.31
# 查看帮助
openclaw-cn --help2.2 三分钟快速体验
初始化配置
openclaw-cn onboard(或者:
openclaw-cn setup)启动网关
openclaw-cn gateway run测试智能体
openclaw-cn agent --to +123 --message "你好,测试一下"
第三章:基础操作
3.1 网关管理(重点)
网关是OpenClaw的核心,需要先启动网关才能使用其他功能。
# 方式1:前台运行(适合调试)
openclaw-cn gateway run
# 方式2:后台服务(推荐日常使用)
openclaw-cn gateway install
openclaw-cn gateway start
openclaw-cn gateway status
# 方式3:开发模式(隔离环境)
openclaw-cn --dev gateway run3.2 消息发送
# 基本格式
openclaw-cn message send --target 目标 --message "消息内容"
# 具体示例
openclaw-cn message send --target +8613812345678 --message "你好,这是一条测试消息"
# 带媒体文件
openclaw-cn message send --target +8613812345678 --message "请看图片" --media photo.jpg
# 指定渠道(如Telegram)
openclaw-cn message send --channel telegram --target @username --message "Hello from Telegram"3.3 使用智能体
# 简单对话
openclaw-cn agent --to +123 --message "今天天气怎么样"
# 使用不同思考级别
openclaw-cn agent --to +123 --message "分析这个数据" --thinking high
# 直接发送回复到渠道
openclaw-cn agent --to +123 --message "生成报告" --deliver第四章:渠道配置
4.1 配置 WhatsApp
# 登录WhatsApp(会显示二维码)
openclaw-cn channels login --verbose
# 验证连接
openclaw-cn status4.2 配置 Telegram
通过 @BotFather 创建机器人,获取token
配置到OpenClaw
向机器人发送消息开始使用
4.3 查看和管理渠道
# 查看所有渠道状态
openclaw-cn status
# 列出可用渠道
openclaw-cn channels list
# 移除渠道
openclaw-cn channels remove whatsapp第五章:实用场景
5.1 日常提醒
# 设置早上提醒
openclaw-cn cron add --name "morning-reminder" --schedule "0 8 * * *" \
--command "openclaw-cn message send --target +123 --message '⏰ 早上好,别忘了今日会议!'"5.2 信息汇总
# 让智能体帮你汇总新闻
openclaw-cn agent --to +123 --message "帮我汇总今天的重要科技新闻"5.3 自动化工作流
# 结合多个命令实现自动化
# 1. 获取天气
# 2. 整理日程
# 3. 发送每日简报
openclaw-cn agent --to +123 --message "请为我准备今天的每日简报,包含天气、新闻和日程提醒" --deliver第六章:故障排除
6.1 网关启动问题
# 端口被占用
openclaw-cn gateway --force run
# 查看详细日志
openclaw-cn gateway --verbose run
# 检查网关健康
openclaw-cn gateway health6.2 渠道连接问题
# 运行健康检查
openclaw-cn doctor
# 查看日志
openclaw-cn logs
# 重启服务
openclaw-cn gateway restart6.3 智能体问题
# 开启详细日志
openclaw-cn agent --to +123 --message "测试" --verbose on
# 重置配置
openclaw-cn configure第七章:进阶功能
7.1 技能系统
# 查看可用技能
openclaw-cn skills list
# 技能详情
openclaw-cn skills info BlueBubbles7.2 定时任务
# 管理定时任务
openclaw-cn cron list
openclaw-cn cron add --name "定时任务名称" --schedule "时间表达式" --command "执行的命令"
openclaw-cn cron remove 任务名称7.3 网络搜索(需要配置)
# 配置网络搜索API
openclaw-cn configure --section web
# 之后就可以让智能体搜索信息
openclaw-cn agent --to +123 --message "搜索今日热点新闻"第八章:常用命令速查
第九章:最佳实践
9.1 日常使用建议
先启动网关:网关必须先运行才能使用其他功能
测试再生产:使用
--dev模式进行测试备份配置:定期备份
%APPDATA%\openclaw-cn\文件夹版本更新:定期检查更新:
npm update -g openclaw-cn
9.2 安全建议
不要将API密钥泄露
配置合适的访问权限
定期更新软件版本
使用强密码
第十章:资源和支持
GitHub仓库:https://github.com/clawdio/clawdbot
问题反馈:GitHub Issues
社区交流:Telegram/Discord频道
开始你的第一个项目
项目1:早安提醒系统
# 1. 创建定时任务
openclaw-cn cron add --name "good-morning" --schedule "0 8 * * *" \
--command "openclaw-cn agent --to +123 --message '早上好!请为我准备今日简报' --deliver"
# 2. 查看任务列表
openclaw-cn cron list
# 3. 立即测试
openclaw-cn cron run good-morning项目2:信息聚合助手
# 创建智能对话任务
openclaw-cn agent --to +123 --message "请帮我完成以下任务:\n1. 检查我的日程\n2. 汇总重要邮件\n3. 分析新闻热点\n完成后发送汇总报告给我"结束语
OpenClaw 就像你的数字管家,帮你处理各种日常任务。从简单的消息发送到复杂的自动化工作流,它都能胜任。
第一步:openclaw-cn onboard 第二步:openclaw-cn gateway start 第三步:openclaw-cn message send --target +123 --message "Hello World!"
开启你的自动化之旅吧!
评论区