Back to Inputs

Cron

input

Schedule your workflow to run at specific times using cron expressions. This input type uses standard cron syntax to define when the workflow should execute automatically.

Configuration

Add a cron input to your workflow to schedule automatic executions:

workflow:
  name: scheduled-workflow
  input:
    type: cron
    cron: "0 9 * * *"
    start_now: false

Configuration Options

Required and optional configuration fields for this input type:

Parameter Type Required Description
type string Yes Set to "cron"
cron string Yes A cron expression defining the schedule (e.g., '0 8 * * 1-5' for 8 AM Mon-Fri)
start_now boolean No Whether to trigger immediately on startup
Default: false
payload object No A static JSON dictionary that will be passed as the payload on every invocation

Cron Syntax

Cron expressions consist of five fields that define when the workflow should run:

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
* * * * *

Note: All times are in UTC. Example: '0 8 * * 1-5' fires at 08:00 UTC Monday through Friday.

Common Patterns

Here are some frequently used cron schedules:

"* * * * *" Every minute
"0 * * * *" Every hour
"0 0 * * *" Daily at midnight
"0 9 * * 1-5" Weekdays at 9 AM
"*/15 * * * *" Every 15 minutes
"0 0 1 * *" First day of month
"0 0 * * 0" Every Sunday
"0 12 * * 1-5" Weekdays at noon

Start Now Option

The start_now parameter determines whether the workflow should trigger immediately when it starts up:

input:
  type: cron
  cron: "0 9 * * *"
  start_now: true  # Triggers once immediately on startup

Static Payload

You can provide a static payload that will be passed to the workflow on each execution:

input:
  type: cron
  cron: "0 9 * * 1-5"
  payload:
    task_type: "daily_report"
    environment: "production"
    recipients:
      - "team@company.com"
      - "manager@company.com"

Example Workflow

Here's a complete example that generates a daily report every weekday morning:

pipeline:
  name: daily-sales-report
  input:
    type: cron
    cron: "0 9 * * 1-5"  # Weekdays at 9 AM UTC
    start_now: false
    payload:
      report_type: "daily"
  steps:
    - type: add_timestamp
      field: generated_at
    - type: http_call
      method: GET
      url: "https://api.company.com/sales/daily"
      output_to: sales_data
    - type: resend_email
      api_key: "${env:RESEND_API_KEY}"
      from_email: "reports@company.com"
      to: "team@company.com"
      subject_template: "Daily Sales Report - ${generated_at}"
      html_template: |
        <h2>Daily Sales Report</h2>
        <p>Total sales: $${sales_data.total}</p>
        <p>Orders: ${sales_data.order_count}</p>

Best Practices

  • UTC Awareness - All cron schedules run in UTC. Convert your local times to UTC when setting schedules
  • Testing - Use start_now: true to test your workflow immediately before setting a schedule
  • Monitoring - Set up alerts for failed scheduled executions
  • Idempotency - Ensure your workflows can run multiple times safely
  • Rate Limits - Be mindful of API rate limits when scheduling frequent executions

Useful Tools

Use online cron expression generators to help create and validate your schedules: