Skip to main content

Scheduled Task Template

Run workflows automatically on a schedule - daily, hourly, or custom intervals. Perfect for reports, monitoring, data syncs, and automated maintenance tasks.

Time to build: 15 minutes Difficulty: Beginner Perfect for: Daily reports, monitoring dashboards, data synchronization, automated cleanups


What It Does

Schedule triggers → Fetch data → Process with AI → Send to destination

Automates recurring tasks without manual intervention.


Step-by-Step

1. Create Workflow with Schedule Trigger

  • New workflow → Name it "Daily Report Generator"
  • Set trigger to Schedule
  • Configure: 0 9 * * * (daily at 9 AM)

2. Add HTTP Request to Fetch Data

  • Drag HTTP Request Block
  • Connect Schedule to HTTP Request
Method: GET
URL: https://api.yourservice.com/metrics?date=<schedule.date>

Headers:
Authorization: Bearer <env.API_KEY>

3. Add Agent for Analysis

  • Drag Agent Block
  • Connect HTTP Request to Agent
Model: GPT-4o

System Prompt:
"You are a business analyst. Create a concise daily summary with key metrics, trends, and insights."

User Prompt:
"Analyze this data and create a daily report: <http_request.body>"

4. Add Database Query to Store Results

  • Drag Database Query Block
  • Connect Agent to Database
INSERT INTO daily_reports (date, summary, metrics, created_at)
VALUES (
'<schedule.date>',
'<agent.content>',
'<http_request.body>',
NOW()
)

5. Send to Slack

  • Drag Slack Tool (or Email)
  • Connect Database to Slack
Channel: #daily-reports
Message:
"📊 Daily Report - <schedule.date>

<agent.content>

View full details: https://dashboard.yourapp.com/reports/<database.insert_id>"

6. Test

  • Click "Run Now" to test without waiting
  • Verify Slack message received
  • Check database for stored report

Common Schedule Patterns

Hourly Monitoring

0 * * * *  # Every hour
*/15 * * * * # Every 15 minutes

Daily Reports

0 9 * * *  # 9 AM daily
0 17 * * 1-5 # 5 PM weekdays only

Weekly Summaries

0 8 * * 1  # Monday 8 AM
0 10 * * 5 # Friday 10 AM

Monthly Tasks

0 0 1 * *  # First day of month at midnight
0 9 L * * # Last day of month at 9 AM

Real-World Examples

Server Health Monitor

  • Every 5 minutes → Check server status → Alert if issues

Database Backup

  • Daily at 2 AM → Backup database → Upload to S3 → Notify on completion

Social Media Scheduler

  • Custom times → Post content → Track engagement → Update analytics

Inventory Sync

  • Every hour → Fetch stock levels → Update e-commerce platform → Alert low stock

Enhancements

Add Error Notifications

  • Use Condition to check for failures
  • Send urgent alerts to PagerDuty or Slack

Add Historical Comparison

  • Fetch previous period data
  • Let AI compare trends and highlight changes

Add Dynamic Scheduling

  • Store schedule preferences in database
  • Adjust timing based on user timezone

Cost

Per execution:

  • GPT-4o: ~$0.01-0.05
  • GPT-4o-mini: ~$0.001-0.005
  • Database + HTTP: Negligible

Monthly cost (daily at 9 AM):

  • GPT-4o: ~$0.30-1.50/month
  • GPT-4o-mini: ~$0.03-0.15/month
Next Step

Combine with Error Handling to ensure critical scheduled tasks always run!