使用案例 • 20 分钟阅读
OpenClaw 任务自动化
为重复性任务与外部触发器创建自动化工作流。
掌握 OpenClaw 自动化:本教程涵盖 cron 定时任务、webhook 以及复杂的多步骤工作流。
Tutorial.step
你将搭建什么
- 用于日常例行的定时任务(cron jobs)
- 用于事件驱动反应的 webhook 端点
- 与 GitHub 等外部服务的集成
- 端到端自动化报告
Tutorial.step
步骤 1:创建 Cron 任务
Cron 可以按计划运行任务。示例:每天 9 点的每日简报:
openclaw.json
{
"cron": {
"enabled": true,
"jobs": [
{
"name": "Daily Briefing",
"cron": "0 9 * * *",
"message": "Give me a daily briefing: check my calendar, summarize important emails, and list my tasks for today."
}
]
}
}格式: minute hour day month weekday
Tutorial.step
步骤 2:设置 Webhooks
Webhook 允许外部服务触发 OpenClaw,非常适合监控 GitHub 或服务器错误:
openclaw.json
{
"webhooks": {
"enabled": true,
"entries": {
"github": {
"provider": "github",
"message": "Process GitHub webhook: {payload}"
},
"sentry": {
"provider": "sentry",
"message": "New Sentry error: {payload}"
}
}
}
}Tutorial.step
步骤 3:多步骤工作流
把多项检查合并成一份报告。示例:晚上 6 点的晚间报告:
openclaw.json
{
"cron": {
"enabled": true,
"jobs": [
{
"name": "Evening Report",
"cron": "0 18 * * *",
"message": "Generate my daily report: 1) Summarize today's calendar events, 2) List completed tasks, 3) Check for important emails, 4) Provide tomorrow's agenda. Format as markdown."
}
]
}
}Tutorial.step
集成外部服务
GitHub Webhook(通知)
当 PR 创建或更新时自动审查。
RSS 订阅监控
扫描博客/新闻源,并在通道里给出摘要。
高级模式
探索 条件自动化(当 X 发生才执行)、链式工作流 与 数据分析流水线。