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 ~/.clawdbot/moltbot.json (file name maintained for backward compatibility):

Webhook Config
{
  "webhooks": {
    "enabled": true,
    "endpoints": {
      "/webhook/github": {
        "handler": "github-webhook-handler"
      }
    }
  }
}

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

Cron Config
{
  "cron": {
    "jobs": [
      {
        "schedule": "0 9 * * *",
        "command": "agent --message 'Daily briefing'"
      },
      {
        "schedule": "*/30 * * * *",
        "command": "check-status"
      }
    ]
  }
}

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:

Daily Briefing Cron
{
  "cron": {
    "jobs": [
      {
        "schedule": "0 9 * * *",
        "command": "agent --message 'Create my daily briefing'"
      }
    ]
  }
}

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

  • Start Simple - Begin with basic cron jobs before complex webhooks
  • Test Thoroughly - Test automation in a safe environment first
  • Monitor Logs - Keep an eye on automation execution logs
  • Error Handling - Ensure automations handle failures gracefully
  • Rate Limiting - Be mindful of API rate limits
  • Security - Secure webhook endpoints with authentication

Learn More