OpenClawSkills
GitHub
Tutorial β€’ TutorialHeader.readTime

Setting Up Automation

Turn your agent into a proactive assistant. Schedule daily tasks with Cron and trigger actions via Webhooks.

What We'll Build

We'll create a Daily Briefing Automation that:

  • Runs automatically every morning at 9 AM
  • Sends you a summary of the day ahead
  • Demonstrates cron job configuration
  • Can be easily customized for your needs

This example covers the fundamentals you need to automate any task.

Prerequisites

Before starting, ensure you have:

  • OpenClaw installed and running - Complete the Getting Started Tutorial
  • A channel connected - Follow the Channel Setup Tutorial
  • Gateway running - Your OpenClaw Gateway should be active
  • Basic understanding of cron syntax - We'll explain it, but familiarity helps
Tutorial.step

Understand Automation Types

OpenClaw supports several automation types:

⏰ Cron Jobs

Scheduled tasks that run at specific times (daily, weekly, etc.)

πŸ”— Webhooks

Trigger actions from external services (GitHub, Sentry, etc.)

πŸ’“ Heartbeat

Continuous monitoring with configurable intervals

For this tutorial, we'll focus on cron jobs - the most common automation type. See the Automation Reference for webhooks and other types.

Tutorial.step

Plan Your Automation

Before writing configuration, let's plan what our automation will do:

Automation Details

  • What: Send a daily briefing message
  • When: Every morning at 9:00 AM
  • How: Use OpenClaw's agent to generate and send the briefing
  • Where: Send to your connected channel (Telegram, WhatsApp, etc.)

Understanding Cron Syntax

Cron uses a time-based schedule format:

Cron Format
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ minute (0 - 59)
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ hour (0 - 23)
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ day of month (1 - 31)
β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ month (1 - 12)
β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ day of week (0 - 6) (Sunday to Saturday)
β”‚ β”‚ β”‚ β”‚ β”‚
* * * * *
0 9 * * *
Every day at 9:00 AM
0 */6 * * *
Every 6 hours
0 9 * * 1
Every Monday at 9:00 AM
*/15 * * * *
Every 15 minutes
Tutorial.step

Create Your Automation

Now let's add the automation to your OpenClaw configuration.

Step 3.1: Open Configuration File

Open your OpenClaw configuration file:

Open Configuration
nano ~/.openclaw/openclaw.json
# or use your preferred editor

Step 3.2: Add Cron Configuration

Add the cron section to your configuration. Here's a complete example:

Automation Configuration
{
  "agents": {
    "defaults": {
      "model": { "primary": "anthropic/claude-opus-4-5" }
    }
  },
  "cron": {
    "enabled": true,
    "jobs": [
      {
        "name": "Daily briefing",
        "cron": "0 9 * * *",
        "message": "Create my daily briefing for today. Include: weather summary, calendar events, and any important reminders.",
        "session": "isolated"
      }
    ]
  }
}

What this does:

  • "cron": "0 9 * * *" - Runs at 9:00 AM every day
  • "message" - The message sent to the agent

The agent will process the message and send the response to your connected channel.

Tutorial.alert.tip

You can customize the message to ask for anything you want in your daily briefing - news summaries, task lists, weather, calendar events, etc.
Tutorial.step

Save and Restart

After adding your automation configuration:

  • Save the configuration file
  • Restart your Gateway to load the new automation
Restart Gateway
# If running as service:
openclaw gateway restart

# Or if running manually, stop and restart:
openclaw gateway --port 18789 --verbose

The Gateway will now load your cron jobs and schedule them according to your schedule.

Tutorial.step

Test Your Automation

You don't have to wait until 9 AM to test! Let's verify it works:

Method A: Test Immediately

Run the command manually to test:

Test Automation
openclaw agent --message 'Create my daily briefing for today. Include: weather summary, calendar events, and any important reminders.'

This should trigger the same response your automation will send. Check your connected channel for the message.

Method B: Test with Short Schedule

For testing, you can temporarily change the schedule to run more frequently:

Test Schedule (Every 5 Minutes)
{
  "cron": {
    "jobs": [
      {
        "schedule": "*/5 * * * *",
        "command": "agent --message 'Test briefing'"
      }
    ]
  }
}

Remember to change it back to your desired schedule after testing!

Tutorial.step

Verify Automation is Running

Check that your automation is scheduled correctly:

Check Gateway Logs

Look for messages in your Gateway logs indicating cron jobs are loaded:

View Logs
# If running as service, check logs:
openclaw gateway logs

# Or check system logs (macOS):
log show --predicate 'process == "openclaw"' --last 5m

Wait for Scheduled Time

If you set it to run at a specific time, wait until that time and check your channel for the automated message.

Tutorial.alert.success

If you receive the automated message at the scheduled time, your automation is working correctly!
Tutorial.step

More Automation Examples

Example 1: Weekly Summary

Weekly Summary
{
  "cron": {
    "jobs": [
      {
        "schedule": "0 18 * * 5",
        "command": "agent --message 'Create a weekly summary of my accomplishments and tasks completed this week.'"
      }
    ]
  }
}

Runs every Friday at 6:00 PM.

Example 2: Reminder Check

Reminder Check
{
  "cron": {
    "jobs": [
      {
        "schedule": "0 8 * * *",
        "command": "agent --message 'Check my calendar and remind me of any important events or deadlines today.'"
      }
    ]
  }
}

Runs every morning at 8:00 AM.

Example 3: Multiple Automations

Multiple Jobs
{
  "cron": {
    "jobs": [
      {
        "schedule": "0 9 * * *",
        "command": "agent --message 'Daily briefing'"
      },
      {
        "schedule": "0 18 * * *",
        "command": "agent --message 'Evening summary'"
      },
      {
        "schedule": "0 0 * * 1",
        "command": "agent --message 'Weekly planning session'"
      }
    ]
  }
}

Manage multiple jobs with different schedules.

Troubleshooting

Automation Not Running

If your automation doesn't run:

  • Check cron syntax: Verify your schedule format is correct
  • Verify Gateway is running: openclaw gateway status
  • Check configuration file: Ensure JSON is valid (no syntax errors)
  • Review Gateway logs: Look for error messages about cron jobs
  • Restart Gateway: Sometimes a restart is needed to load new automations
Wrong Time Zone

Cron jobs use your system's timezone. If times seem wrong:

  • Check your system timezone: date
  • Adjust your schedule accordingly
  • Or set a specific timezone in your system settings
Command Not Executing

If the command doesn't execute:

  • Test the command manually first (outside of cron)
  • Check that the agent command syntax is correct
  • Verify your channel is connected (for message delivery)
Tutorial.step

Next Steps

Now that you understand automation basics, explore advanced features:

πŸ’“ Use Heartbeat
Set up continuous monitoring with configurable intervals.

Best Practices

  • Start Simple - Begin with basic cron jobs before complex webhooks
  • Test First - Always test commands manually before automating
  • Monitor Logs - Keep an eye on automation execution logs
  • Handle Errors - Ensure automations handle failures gracefully
  • Be Mindful of Rate Limits - Don't create automations that hit API limits
  • Secure Webhooks - If using webhooks, add authentication