Automation: cron, hooks, webhooks & tasks

Schedules, gateway hooks, HTTP triggers, background work, and standing orders—summarized here; details stay current in the official automation docs.

New to automation? Start with the Automation Tutorial for a hands-on walkthrough. This page collects common patterns and example config; when in doubt, follow the official automation documentation.

You can wake the agent on a timer, when a message or lifecycle event fires inside the gateway, when another system posts to a webhook, or through background tasks and standing orders. The sections below mirror that split; use them together with the official docs linked above.

Tip: Start with one cron job (e.g. a daily briefing) before adding webhooks. Cron is the easiest way to get "wake up and do something" behavior; webhooks are great once you have a specific external trigger (GitHub, Sentry, etc.).

How time and events reach your agent

Same idea everywhere: something happens, the gateway can wake your agent. The names differ so you can find the right upstream doc.

  • On a schedule (cron) — e.g. every morning or every N minutes. Official: Scheduled tasks (cron). CLI: openclaw cron.
  • Inside the gateway (hooks) — small scripts when a message arrives, a command runs, the gateway starts, and similar. Official: Hooks.
  • HTTP from another system (webhooks) — builds, forms, alerts. Official hub: Automation (webhooks are covered there with cron).
  • Long-running follow-ups (tasks / task flow) — work that continues in the background. This site: Task flow operations. Official: Task flow, Background tasks.

Standing orders — short standing instructions the agent keeps across turns. Official: Standing orders.

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 config file: ~/.openclaw/openclaw.json:

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

Add the cron block to ~/.openclaw/openclaw.json. Restart the Gateway after editing.

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

Example pattern: send Sentry (or similar) events to a webhook so the agent can triage:

  • Receive error notifications via webhook
  • Agent can summarize impact and suggest next steps
  • You stay in control of any code change or pull request
  • Optional follow-up message when you mark the incident closed

GitHub Automation

Common GitHub webhook flows people wire up:

  • Summarize or triage new pull requests
  • React to pushes or CI status (with care for rate limits and secrets)
  • Update issues or labels from chat-driven commands
  • Coordinate deploy steps only where your policy allows it

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

Related docs