Automation
Let your agent work while you sleep. Cron jobs, Webhooks, and Event Triggers.
New to automation? For a hands-on, step-by-step tutorial, check out our Automation Tutorial. This page is a comprehensive reference covering all automation features and configuration options.
OpenClaw provides powerful automation capabilities through webhooks, cron jobs, and hooks. These features allow you to create automated workflows, trigger actions based on events, and integrate with external services.
Webhooks
Webhooks allow external services to trigger OpenClaw actions:
- Receive Events - Accept webhook calls from external services
- Trigger Actions - Execute agent tasks based on webhook payloads
- Integrate Services - Connect with GitHub, Sentry, monitoring tools, etc.
Webhook Configuration
Configure webhooks in your :
{
"webhooks": {
"enabled": true,
"entries": {
"github-alerts": {
"provider": "github",
"secret": "YOUR_WEBHOOK_SECRET"
}
}
}
}Use Cases
- GitHub webhooks for PR reviews and issue management
- Sentry webhooks for error monitoring and auto-fixing
- Custom API integrations
- Event-driven automation
Cron Jobs
Cron jobs allow scheduled tasks to run automatically:
- Scheduled Tasks - Run tasks on a schedule (daily, weekly, etc.)
- Background Processing - Execute long-running tasks
- Periodic Checks - Monitor systems, check status, etc.
Cron Job Configuration
Add cron jobs using the CLI:
# Daily briefing openclaw cron add --name "Morning brief" --cron "0 9 * * *" --session isolated --message "Daily briefing" # Status check openclaw cron add --name "Status check" --cron "*/30 * * * *" --session main --system-event "check-status" --wake now
Cron vs Heartbeat
OpenClaw supports two scheduling mechanisms:
- Cron Jobs: Traditional cron syntax for scheduled tasks
- Heartbeat: Continuous monitoring with configurable intervals
Use cron for specific time-based tasks, heartbeat for continuous monitoring.
Hooks
Hooks allow you to intercept and modify events:
- Message Hooks - Process messages before/after agent handling
- Event Hooks - React to system events
- Transcription Hooks - Process voice notes and audio
Gmail Pub/Sub Hooks
OpenClaw can integrate with Gmail via Pub/Sub:
- Receive real-time email notifications
- Process emails automatically
- Trigger actions based on email content
- Manage inbox and responses
Configure Gmail Pub/Sub in your workspace for email automation.
Automation Examples
Daily Briefing
Schedule a daily briefing that summarizes your day:
openclaw cron add \ --name "Daily Briefing" \ --cron "0 9 * * *" \ --session isolated \ --message "Create my daily briefing" \ --deliver \ --channel last
Error Monitoring
Set up webhook to auto-fix errors from Sentry:
- Receive error notifications via webhook
- Agent analyzes the error
- Automatically creates fix or opens PR
- Notifies you when resolved
GitHub Automation
Automate GitHub workflows:
- Review PRs automatically
- Run tests on commits
- Manage issues and labels
- Deploy on successful builds
Best Practices
- 1Start SimpleBegin with basic cron jobs before complex webhooks.
- 2Test ThoroughlyTest automation in a safe environment first.
- 3Monitor LogsKeep an eye on automation execution logs.
- 4Error HandlingEnsure automations handle failures gracefully.
- 5Rate LimitingBe mindful of API rate limits.
- 6SecuritySecure webhook endpoints with authentication.