building-your-first-automation-workflow
Building Your First Automation Workflow with OpenClaw
Automation is the soul of a self-sufficient assistant. At its core, OpenClaw is designed to take the repetitive, time-consuming tasks off your plate and handle them with precision and consistency. Whether it's monitoring your inbox, managing your calendar, or interacting with web services, building your first automation workflow is a pivotal step in unlocking the full potential of your AI assistant.
Why Automate?
Before diving into the how, it's worth asking why. Automation in OpenClaw isn't just about doing things faster; it's about creating a system where your assistant acts with agency. Instead of waiting for you to open a chat and type a command, your assistant can proactively check in, surface important information, and keep your digital world in order—all without your direct, moment-by-moment input.
The benefits are clear:
- Consistency: Critical tasks are performed the same way every time, eliminating human error.
- Timeliness: Your assistant can wake up your inbox or calendar at regular intervals, ensuring nothing slips through the cracks.
- Peace of Mind: Once a workflow is built and tested, you can trust it to run, freeing up your mental bandwidth for more creative and strategic work.
The Tools of the Trade: Heartbeat vs. Cron
OpenClaw provides two primary mechanisms for scheduling automated tasks: the heartbeat and cron jobs. Understanding the difference is key to building effective automations.
Heartbeat: Your Assistant's Pulse
Think of the heartbeat as your assistant's regularly scheduled check-in. By default, it runs every 30 minutes, and it's designed to batch multiple small checks together—like reviewing your urgent emails, checking your calendar for the next two hours, or scanning for new notifications.
The heartbeat is perfect for tasks that don't require an exact time—"sometime around 3 PM" is fine. Because it runs in the main session, your assistant has full context of your recent conversations, allowing it to make smarter, more nuanced decisions.
Cron Jobs: Precision Scheduling
On the other hand, cron jobs are for precision. If you need something to run at exactly 9:00 AM every Monday, a cron job is the tool to use. It uses the standard Unix cron syntax to define when a task should execute.
Cron jobs can run in isolated sessions, meaning they don't clutter your main chat history. They can also use different models or reasoning levels, allowing you to run a heavy, in-depth analysis at 6:00 AM without impacting your assistant's performance during the day.
| Feature | Heartbeat | Cron | |---------|---------|------| | Timing | Approximate (e.g., every 30 min) | Precise (e.g., 9:00 AM every Mon) | | Session | Main (has full context) | Can be isolated (clean slate) | | Use Case | Batching checks (email, calendar) | Exact schedules, heavy analysis |
As a beginner, start with the heartbeat. It's simpler, keeps everything in one place, and encourages you to think about your assistant's routine rather than isolated tasks.
Your First Workflow: A Simple Heartbeat Check
Let's put this into practice. We'll create a basic automation that checks your email for any urgent messages during each heartbeat.
Step 1: Enable the Heartbeat
First, you need to make sure the heartbeat system is enabled in your OpenClaw configuration. This is typically set in your openclaw.json config file.
{
"agents": {
"defaults": {
"heartbeat": {
"enabled": true,
"every": "30m"
}
}
}
}
This tells OpenClaw to trigger a heartbeat every 30 minutes.
Step 2: Create Your HEARTBEAT.md Checklist
The heartbeat's behavior is controlled by a special file called HEARTBEAT.md in your workspace. OpenClaw reads this file on every heartbeat cycle and follows the instructions inside.
Create a file named HEARTBEAT.md in your OpenClaw workspace and add the following:
# Heartbeat Checklist
- Check Gmail for any unread urgent emails
- If an event starts within the next 90 minutes, announce it
- Summarize any pending tasks from Things
- If it's been over 8 hours since the last message, send a light check-in
This checklist serves as a simple script that your assistant will follow. It's written in plain English, making it easy to understand and modify. The assistant will read each item, perform the check, and if something important is found, it will alert you.
Step 3: Implement the Actions
Under the hood, OpenClaw tools like gog.gmail for Gmail and things for Things 3 will do the heavy lifting. For example, when your assistant checks your Gmail, it might execute a command like:
gog gmail list --label urgent --unread
If no emails are returned, the assistant silently moves to the next item. If there are urgent emails, it uses its judgment to summarize the most important one and delivers the summary to your preferred channel—like WhatsApp or Slack.
Testing and Iterating
After you've set up your HEARTBEAT.md file, simply wait for the next heartbeat cycle. If all goes well, you should receive a check-in from your assistant.
If you want to test it immediately, you can manually trigger a heartbeat by sending the exact text Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK. to OpenClaw. This is the system-level prompt for a heartbeat. OpenClaw will process the directive and run the checklist.
No system is perfect on the first try. Pay attention to the assistant's behavior. Is it checking the right labels? Is it summarizing appropriately? Edit your HEARTBEAT.md file to refine the workflow. For instance, you might change "urgent emails" to "emails from your boss or clients" to be more specific.
Scaling Up
Once you're comfortable with a simple heartbeat, the possibilities expand.
- Add a cron job to send you a daily morning briefing at 7:00 AM.
- Integrate with Notion to create a weekly project status report.
- Use browser automation to monitor a website for price changes and notify you when a deal appears.
The key is to start small. Build a solid foundation with one or two reliable workflows, and then gradually add complexity. With OpenClaw, you're not just setting up scripts—you're building a living, evolving system of automation that grows smarter over time.
Your first workflow is now in motion. It's a quiet, reliable presence, checking in on your behalf. That's the power of automation: not flashy, but profoundly effective.
Enjoyed this article?
Join the ClawMakers community to discuss this and more with fellow builders.
Join on Skool — It's Free →