Introduction
OpenClaw is more than just a chatbot -- it can also serve as the core of your automation workflows. Through scheduled tasks, event-driven triggers, and third-party integrations, you can have OpenClaw automatically handle daily report summaries, content monitoring, message forwarding, and more. This article introduces a variety of practical automation approaches.
1. Scheduled Tasks (Cron Integration)
1.1 Basic Concept
Trigger AI tasks on a schedule by calling OpenClaw's API via cron:
# Send a message via the OpenClaw Gateway API
curl -X POST http://localhost:18789/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "YOUR_CHAT_ID",
"message": "Please generate today'\''s work summary"
}'
1.2 Daily Morning Briefing
Create a scheduled task that pushes a news summary every morning at 8:00 AM:
#!/bin/bash
# /usr/local/bin/openclaw-morning-brief.sh
API_URL="http://localhost:18789/api/v1/chat"
CHAT_ID="YOUR_TELEGRAM_CHAT_ID"
# Call OpenClaw to generate the morning briefing
RESPONSE=$(curl -sf -X POST "$API_URL" \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "'"$CHAT_ID"'",
"message": "Based on today'\''s date, generate a morning briefing that includes: 1. What day it is today 2. Weather reminders 3. To-do review 4. An inspirational quote",
"systemPrompt": "You are a professional daily briefing assistant. Keep your replies concise and well-organized, using emoji to enhance readability."
}')
echo "[$(date)] Morning briefing sent: $RESPONSE" >> /var/log/openclaw-cron.log
# Set up the cron job
chmod +x /usr/local/bin/openclaw-morning-brief.sh
crontab -e
# Add the following line (runs at 8:00 AM daily)
# 0 8 * * * /usr/local/bin/openclaw-morning-brief.sh
1.3 Periodic System Health Report
#!/bin/bash
# /usr/local/bin/openclaw-system-report.sh
# Gather system information
DISK_USAGE=$(df -h / | tail -1 | awk '{print $5}')
MEMORY_USAGE=$(free -m | awk 'NR==2{printf "%.1f%%", $3*100/$2}')
CPU_LOAD=$(uptime | awk -F'load average: ' '{print $2}')
OPENCLAW_STATUS=$(curl -sf http://localhost:18789/health | jq -r '.status')
UPTIME=$(uptime -p)
# Build the report content
REPORT="Server Health Report:
- Uptime: $UPTIME
- CPU Load: $CPU_LOAD
- Memory Usage: $MEMORY_USAGE
- Disk Usage: $DISK_USAGE
- OpenClaw Status: $OPENCLAW_STATUS
Please analyze the data above and provide optimization recommendations for any abnormal metrics."
# Send to the administrator
curl -sf -X POST http://localhost:18789/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "ADMIN_CHAT_ID",
"message": "'"$(echo "$REPORT" | sed 's/"/\\"/g')"'"
}'
# Generate the health report at 10:00 PM daily
# 0 22 * * * /usr/local/bin/openclaw-system-report.sh
2. Event-Driven Workflows
2.1 File Change Triggers
Monitor a directory and automatically process new files:
#!/bin/bash
# /usr/local/bin/openclaw-file-watcher.sh
# Uses inotifywait to monitor file changes
WATCH_DIR="/home/user/incoming-docs"
API_URL="http://localhost:18789/api/v1/chat"
inotifywait -m -e create "$WATCH_DIR" --format '%f' | while read filename; do
echo "[$(date)] New file detected: $filename"
# Read file content (limited size)
CONTENT=$(head -c 5000 "$WATCH_DIR/$filename")
# Send to OpenClaw for processing
curl -sf -X POST "$API_URL" \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "ADMIN_CHAT_ID",
"message": "New file received: '"$filename"'. Please summarize the key points:\n\n'"$(echo "$CONTENT" | jq -Rs .)"'"
}'
done
2.2 Log Keyword Triggers
Monitor system logs for anomalies, with automatic notification and analysis:
#!/bin/bash
# /usr/local/bin/openclaw-log-monitor.sh
LOG_FILE="/var/log/syslog"
KEYWORDS="error|critical|failure|out of memory"
tail -F "$LOG_FILE" | grep --line-buffered -iE "$KEYWORDS" | while read logline; do
# Alert storm prevention: send at most once per minute
CURRENT_MINUTE=$(date +%Y%m%d%H%M)
if [ "$CURRENT_MINUTE" != "$LAST_ALERT_MINUTE" ]; then
curl -sf -X POST http://localhost:18789/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "ADMIN_CHAT_ID",
"message": "⚠️ System log anomaly:\n'"$(echo "$logline" | head -c 500)"'\n\nPlease analyze the possible causes and recommend a course of action."
}'
LAST_ALERT_MINUTE="$CURRENT_MINUTE"
fi
done
3. Webhook Receiver
3.1 OpenClaw Built-In Webhook Support
OpenClaw Gateway can receive external Webhooks and trigger corresponding actions:
// ~/.config/openclaw/openclaw.json5
{
"webhooks": {
"enabled": true,
"port": 18789,
"endpoints": {
"/webhook/github": {
"secret": "your-webhook-secret",
"action": "notify",
"channel": "telegram",
"chatId": "GROUP_CHAT_ID",
"template": "GitHub event: {{event}} - {{payload.action}}"
},
"/webhook/custom": {
"action": "process",
"handler": "custom-webhook-skill"
}
}
}
}
3.2 GitHub Webhook Integration
After setting up a Webhook in your GitHub repository, OpenClaw can receive push notifications:
# Test Webhook reception
curl -X POST http://localhost:18789/webhook/github \
-H "Content-Type: application/json" \
-H "X-Hub-Signature-256: sha256=..." \
-d '{
"action": "opened",
"pull_request": {
"title": "Fix login bug",
"body": "Fixes the timeout issue on login page",
"user": {"login": "developer1"}
}
}'
3.3 Custom Webhook Skill
Create a skill file to handle Webhooks:
<!-- ~/.openclaw/skills/webhook-handler.SKILL.md -->
# Webhook Handler
When you receive an external Webhook notification, you should:
1. Parse the Webhook content
2. Extract key information
3. Provide a concise summary
4. If it is an urgent event, mark it as "URGENT"
## Supported Webhook Types
- GitHub (PR, Issue, Push)
- Monitoring alerts (server status)
- Custom business events
4. n8n Integration
n8n is a powerful open-source workflow automation tool that integrates deeply with OpenClaw.
4.1 Installing n8n
# Install n8n via Docker
docker run -d \
--name n8n \
--restart=always \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
n8nio/n8n
4.2 n8n Workflow Calling OpenClaw
Create an HTTP Request node in n8n to connect to OpenClaw:
{
"nodes": [
{
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"rule": {
"interval": [{"field": "hours", "hoursInterval": 1}]
}
}
},
{
"name": "Call OpenClaw",
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "http://localhost:18789/api/v1/chat",
"method": "POST",
"body": {
"message": "Check system status for the past hour and generate a report",
"channel": "internal"
}
}
},
{
"name": "Send to Slack",
"type": "n8n-nodes-base.slack",
"parameters": {
"channel": "#ops-alerts",
"text": "="
}
}
]
}
4.3 Common n8n + OpenClaw Workflows
| Workflow | Trigger | Description |
|---|---|---|
| Email summary | New email received | AI summarizes email highlights and pushes notification |
| RSS monitoring | Scheduled polling | Monitors RSS feeds and generates summaries for new articles |
| Form processing | Webhook | AI analyzes form submissions and sends a reply |
| Data report | Daily schedule | Queries database and generates a daily report |
| Customer service routing | Message received | AI classifies the issue and assigns it accordingly |
5. Make (Integromat) Integration
Make provides a more intuitive visual interface for building workflows.
5.1 Creating an OpenClaw API Module
Connect OpenClaw using an HTTP module in Make:
Trigger (Schedule/Webhook)
↓
HTTP Module → POST http://your-server:18789/api/v1/chat
↓
Parse Response (JSON Parse)
↓
Send Result (Email/Slack/Telegram)
6. Practical Workflow Examples
6.1 Automated Daily Summary
Automatically summarize all channel conversations at 6:00 PM every day and generate a daily report:
#!/bin/bash
# /usr/local/bin/openclaw-daily-summary.sh
# Get today's conversation statistics
STATS=$(curl -sf http://localhost:18789/api/v1/stats/today)
# Ask OpenClaw to generate a summary
curl -sf -X POST http://localhost:18789/api/v1/chat \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "ADMIN_CHAT_ID",
"message": "Please generate a daily report summary based on the following statistics:\n\n'"$STATS"'\n\nFormat: 1. Overall overview 2. Hot topics 3. Items requiring attention",
"systemPrompt": "You are a professional data analyst, skilled at extracting valuable insights from chat data."
}'
6.2 Content Monitoring and Alerting
Monitor specific websites for content changes and notify users when updates are detected:
#!/bin/bash
# /usr/local/bin/openclaw-content-monitor.sh
URLS=(
"https://example.com/api/announcements"
"https://status.anthropic.com/api/v2/summary.json"
)
CACHE_DIR="/tmp/openclaw-monitor"
mkdir -p "$CACHE_DIR"
for url in "${URLS[@]}"; do
HASH_FILE="$CACHE_DIR/$(echo "$url" | md5sum | cut -d' ' -f1)"
CURRENT_CONTENT=$(curl -sf "$url")
CURRENT_HASH=$(echo "$CURRENT_CONTENT" | md5sum | cut -d' ' -f1)
if [ -f "$HASH_FILE" ]; then
OLD_HASH=$(cat "$HASH_FILE")
if [ "$CURRENT_HASH" != "$OLD_HASH" ]; then
echo "[$(date)] Content change detected: $url"
# Notify OpenClaw to analyze the change
curl -sf -X POST http://localhost:18789/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"channel": "telegram",
"chatId": "ADMIN_CHAT_ID",
"message": "Content change detected:\nURL: '"$url"'\n\nNew content summary:\n'"$(echo "$CURRENT_CONTENT" | head -c 2000)"'"
}'
fi
fi
echo "$CURRENT_HASH" > "$HASH_FILE"
done
# Check every 30 minutes
# */30 * * * * /usr/local/bin/openclaw-content-monitor.sh
6.3 Multi-Channel Message Sync
Automatically forward important messages from one channel to others:
// ~/.config/openclaw/openclaw.json5
{
"automation": {
"messageForwarding": {
"rules": [
{
"from": {"channel": "telegram", "chatId": "GROUP_A"},
"to": [
{"channel": "discord", "chatId": "CHANNEL_ID"},
{"channel": "slack", "chatId": "#general"}
],
"filter": {
"keywords": ["announcement", "important", "urgent"],
"fromUsers": ["admin"]
}
}
]
}
}
}
7. Workflow Debugging Tips
7.1 Log Inspection
# View automation-related logs
openclaw logs | grep -i "automation\|webhook\|cron\|schedule"
# Test API calls
curl -v -X POST http://localhost:18789/api/v1/chat \
-H "Content-Type: application/json" \
-d '{"message":"test","channel":"internal"}'
7.2 Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Cron not executing | Path or environment variable issues | Use absolute paths, set PATH |
| Webhook not receiving | Firewall or port not open | Check firewall rules |
| API returns 401 | Authentication not configured | Add an API Key |
| Response timeout | Task processing takes too long | Increase timeout settings |
8. Security Considerations
- Webhook signature verification: Enable a Webhook Secret to prevent forged requests
- API authentication: Set an authentication Token for the OpenClaw API
- Input sanitization: Clean external inputs to prevent prompt injection
- Rate limiting: Set reasonable execution frequencies for automation tasks
- Audit logging: Log all automated actions for post-hoc review
With these approaches, you can turn OpenClaw into a powerful automation workflow hub, dramatically boosting your productivity.