LoopFour

Schedule Triggers

Trigger workflows on a time-based schedule using cron or intervals

Schedule Triggers

Schedule triggers start workflows at specified times using cron expressions or interval-based scheduling. Powered by Trigger.dev's scheduling infrastructure.

Configuration

Schedule triggers support two modes: cron expressions and intervals.

{
  "trigger": {
    "type": "schedule",
    "cron": "0 9 * * 1-5",
    "timezone": "America/New_York",
    "enabled": true
  }
}
FieldTypeRequiredDescription
typestringYesMust be "schedule"
cronstringNo*Cron expression (e.g., "0 9 * * 1-5")
intervalobjectNo*Interval configuration
interval.valuenumberYesInterval value (1-525600)
interval.unitstringYesminutes, hours, days, or weeks
timezonestringNoIANA timezone (default: "UTC")
enabledbooleanNoEnable/disable schedule (default: true)

You must specify either cron or interval, but not both.

Cron Syntax

Cron expressions follow standard 5-field format:

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

Special Characters

CharacterDescriptionExample
*Any value* * * * * (every minute)
,List separator0,30 * * * * (at 0 and 30 minutes)
-Range0 9-17 * * * (9am to 5pm)
/Step values*/15 * * * * (every 15 minutes)

Common Schedules

ScheduleCron ExpressionDescription
Every minute* * * * *Runs every minute
Every 15 minutes*/15 * * * *At 0, 15, 30, 45 past the hour
Every hour0 * * * *At the start of every hour
Daily at 9am0 9 * * *Every day at 9:00 AM
Weekdays at 9am0 9 * * 1-5Monday-Friday at 9:00 AM
Weekly on Monday0 9 * * 1Mondays at 9:00 AM
Monthly on 1st0 9 1 * *First of month at 9:00 AM
Quarterly0 9 1 1,4,7,10 *First of Jan, Apr, Jul, Oct

Workflow Examples

Daily Invoice Sync (9am EST):

{
  "name": "Daily Invoice Sync",
  "trigger": {
    "type": "schedule",
    "cron": "0 9 * * *",
    "timezone": "America/New_York"
  },
  "steps": [
    {
      "id": "fetch-invoices",
      "type": "action",
      "action": "quickbooks.listInvoices",
      "config": {
        "filter": "DueDate < '{{now}}'"
      }
    }
  ]
}

Weekly Report (Fridays at 5pm):

{
  "name": "Weekly Sales Report",
  "trigger": {
    "type": "schedule",
    "cron": "0 17 * * 5",
    "timezone": "America/Los_Angeles"
  },
  "steps": [...]
}

Interval-Based Scheduling

For simpler recurring schedules, use intervals:

{
  "trigger": {
    "type": "schedule",
    "interval": {
      "value": 4,
      "unit": "hours"
    }
  }
}

Interval Units

UnitMax ValueExample
minutes525600 (1 year)Every 30 minutes
hours8760 (1 year)Every 4 hours
days365Every day
weeks52Every week

Interval Examples

Every 30 minutes:

{
  "trigger": {
    "type": "schedule",
    "interval": { "value": 30, "unit": "minutes" }
  }
}

Every 6 hours:

{
  "trigger": {
    "type": "schedule",
    "interval": { "value": 6, "unit": "hours" }
  }
}

Weekly:

{
  "trigger": {
    "type": "schedule",
    "interval": { "value": 1, "unit": "weeks" }
  }
}

Timezone Handling

Always specify a timezone for consistent execution times:

{
  "trigger": {
    "type": "schedule",
    "cron": "0 9 * * *",
    "timezone": "America/New_York"
  }
}

Common Timezones

RegionTimezone
US EasternAmerica/New_York
US CentralAmerica/Chicago
US MountainAmerica/Denver
US PacificAmerica/Los_Angeles
UKEurope/London
Central EuropeEurope/Berlin
IndiaAsia/Kolkata
JapanAsia/Tokyo
AustraliaAustralia/Sydney
UTCUTC

Without a timezone, schedules default to UTC. This may cause unexpected execution times.

Daylight Saving Time

Schedules automatically adjust for DST transitions:

  • Spring forward: A 2am schedule may skip when clocks move from 2am to 3am
  • Fall back: A 1am schedule may run twice when clocks move from 2am to 1am

For critical schedules, consider using UTC to avoid DST edge cases.

Enabling and Disabling

Temporarily disable a schedule without deleting the workflow:

{
  "trigger": {
    "type": "schedule",
    "cron": "0 9 * * *",
    "enabled": false
  }
}

Re-enable by setting enabled: true or removing the field.

Input Data

Scheduled workflows receive execution metadata as input:

{
  "input": {
    "scheduledTime": "2024-01-15T09:00:00.000Z",
    "executionTime": "2024-01-15T09:00:01.234Z",
    "timezone": "America/New_York",
    "schedule": {
      "type": "cron",
      "expression": "0 9 * * *"
    }
  }
}
FieldDescription
scheduledTimeWhen the run was scheduled to start
executionTimeWhen the run actually started
timezoneConfigured timezone
schedule.typecron or interval
schedule.expressionThe cron or interval definition

Access in your steps:

{
  "config": {
    "message": "Running scheduled job for {{input.scheduledTime}}"
  }
}

Execution Guarantees

At-Least-Once Delivery

Scheduled workflows are guaranteed to run at least once per scheduled time. In rare cases (infrastructure issues), a schedule may run more than once.

Design for idempotency:

{
  "id": "process-daily",
  "type": "action",
  "config": {
    "idempotencyKey": "daily-sync-{{input.scheduledTime | date: '%Y-%m-%d'}}"
  }
}

Missed Schedules

If a schedule is missed (workflow was paused, system outage), the missed execution is not automatically recovered. The next scheduled execution runs as normal.

For critical schedules, consider:

  1. Monitoring workflow run history
  2. Alerting on missed executions
  3. Running catch-up logic on workflow resume

Concurrency

By default, a new scheduled run starts even if the previous run is still executing. To prevent overlap:

{
  "settings": {
    "concurrencyLimit": 1
  }
}

Complete Example

{
  "name": "Daily Overdue Invoice Reminder",
  "description": "Send Slack reminders for overdue invoices every weekday at 9am",
  "trigger": {
    "type": "schedule",
    "cron": "0 9 * * 1-5",
    "timezone": "America/New_York"
  },
  "steps": [
    {
      "id": "fetch-overdue",
      "type": "action",
      "name": "Get Overdue Invoices",
      "action": "quickbooks.listInvoices",
      "config": {
        "filter": "DueDate < '{{input.scheduledTime}}' AND Balance > 0"
      }
    },
    {
      "id": "check-count",
      "type": "condition",
      "name": "Check if any overdue",
      "config": {
        "conditions": {
          "left": "{{steps.fetch-overdue.output.invoices.length}}",
          "operator": "gt",
          "right": "0"
        },
        "then": ["send-reminder"],
        "else": []
      }
    },
    {
      "id": "send-reminder",
      "type": "slack",
      "name": "Send Slack Reminder",
      "config": {
        "action": "sendMessage",
        "channel": "#finance",
        "text": "You have {{steps.fetch-overdue.output.invoices.length}} overdue invoices totaling ${{steps.fetch-overdue.output.totalBalance}}"
      }
    }
  ]
}

Troubleshooting

Schedule Not Running

  1. Check workflow status - Must be active
  2. Verify enabled - Must be true (or not set)
  3. Check timezone - Ensure correct IANA timezone
  4. Validate cron - Use a cron validator tool

Wrong Execution Time

  1. Check timezone - Common issue is UTC vs local
  2. Verify DST - Times may shift during DST transitions
  3. Review cron syntax - Especially day-of-week (0 = Sunday)

Missing Runs

  1. Check workflow history - Confirm workflow was active
  2. Review system status - Check for outages
  3. Verify concurrency - Previous run may still be executing

Next Steps