/n8n-tutorials

How to schedule workflows in n8n?

Learn how to schedule workflows in n8n using Scheduler and Cron nodes or workflow settings to automate tasks at specific times with ease and flexibility.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to schedule workflows in n8n?

Scheduling workflows in n8n allows you to automate tasks to run at specific times without manual intervention. You can set up workflows to run at regular intervals (like every hour, day, or week) or at specific times using cron expressions. n8n offers multiple ways to schedule workflows including the built-in Scheduler node, Cron node, and the workflow settings within the n8n interface.

 

Step 1: Understanding Scheduling Options in n8n

 

Before diving into the specific methods, it's important to understand the different ways you can schedule workflows in n8n:

  • Scheduler Node: A node you can add to your workflow that triggers execution at specified intervals.
  • Cron Node: Similar to the Scheduler node but offers more advanced scheduling using cron expressions.
  • Workflow Settings: You can set execution schedules directly in the workflow settings without adding special nodes.

Each method has its advantages depending on your specific needs. Let's explore each option in detail.

 

Step 2: Using the Scheduler Node

 

The Scheduler node is the simplest way to schedule your workflow to run at regular intervals. Here's how to set it up:

  1. Create a new workflow or open an existing one.
  2. Add a Scheduler node as the first node in your workflow (trigger node).
  3. Configure the Scheduler node with your desired frequency.

To add and configure a Scheduler node:

  1. Click on the "+" button in the n8n interface to add a new node.
  2. Search for "Scheduler" and select it.
  3. In the node settings, you'll see options to configure when and how often the workflow should run.

The Scheduler node offers several configuration options:

  • Interval: Choose between seconds, minutes, hours, days, or weeks.
  • Value: Specify how many units of the chosen interval (e.g., run every 5 minutes).

Example configuration for running a workflow every 30 minutes:


{
  "interval": "minutes",
  "value": 30
}

 

Step 3: Using the Cron Node for Advanced Scheduling

 

For more complex scheduling requirements, the Cron node provides greater flexibility using cron expressions:

  1. Add a Cron node as your trigger node.
  2. Configure the cron expression based on your scheduling needs.

The Cron node uses standard cron syntax with five or six fields:


- _ _ _ _ \*
┬ ┬ ┬ ┬ ┬ ┬
│ │ │ │ │ │
│ │ │ │ │ └── day of week (0 - 7, where 0 and 7 are Sunday)
│ │ │ │ └──── month (1 - 12)
│ │ │ └────── day of month (1 - 31)
│ │ └──────── hour (0 - 23)
│ └────────── minute (0 - 59)
└──────────── second (0 - 59, optional)

Examples of common cron expressions:

  • Every weekday at 9 AM: 0 0 9 _ _ 1-5
  • Every hour on the half-hour: 0 30 _ _ _ _
  • First day of every month at midnight: 0 0 0 1 _ _

To configure the Cron node:

  1. Add a Cron node to your workflow.
  2. Enter your cron expression in the "Cron Expression" field.
  3. Optionally, set a timezone to ensure the schedule runs according to the specified timezone.

 

Step 4: Scheduling via Workflow Settings

 

n8n also allows you to schedule workflows directly from the workflow settings without adding a specific trigger node:

  1. Open your workflow.
  2. Click on the gear icon (⚙️) in the top right to open workflow settings.
  3. Go to the "Workflow" tab.
  4. Enable the "Active" toggle to activate the workflow.
  5. Under "Timing," select when you want the workflow to run.

You can choose between:

  • Interval: Run the workflow at regular intervals.
  • Cron: Use cron expressions for more precise scheduling.

For interval-based scheduling:

  1. Select "Interval" from the dropdown.
  2. Enter the value and select the time unit (seconds, minutes, hours, etc.).

For cron-based scheduling:

  1. Select "Cron" from the dropdown.
  2. Enter your cron expression.
  3. Select the appropriate timezone.

This method is particularly useful when you want to convert an existing workflow into a scheduled one without modifying its node structure.

 

Step 5: Testing Your Scheduled Workflow

 

Before relying on your scheduled workflow for production tasks, it's important to test it:

  1. After setting up your schedule, save your workflow.
  2. For immediate testing, you can manually execute the workflow by clicking the "Execute Workflow" button.
  3. Check the execution log to verify that the workflow runs as expected.

To view past executions and verify your scheduling:

  1. Go to the "Executions" tab in n8n.
  2. Look for executions of your workflow to confirm they're running at the scheduled times.
  3. Check the status of each execution to ensure they completed successfully.

 

Step 6: Managing Scheduled Workflows

 

As you create more scheduled workflows, proper management becomes important:

  1. Give your workflows descriptive names that indicate their schedule and purpose.
  2. Use tags to categorize scheduled workflows.
  3. Monitor workflow executions regularly to ensure they're running as expected.

To temporarily pause a scheduled workflow:

  1. Go to the workflow settings (gear icon).
  2. Turn off the "Active" toggle.
  3. Save the workflow.

This will prevent the workflow from running on its schedule until you activate it again.

 

Step 7: Handling Timezone Considerations

 

Timezone settings are crucial for scheduled workflows, especially for global teams:

  1. When using the Cron node or workflow settings with cron expressions, always specify the timezone.
  2. To set the timezone:
  • In the Cron node: Select the appropriate timezone from the dropdown.
  • In workflow settings: Select the timezone after entering the cron expression.

Common timezone options include:

  • UTC (Coordinated Universal Time)
  • America/New\_York
  • Europe/London
  • Asia/Tokyo

Using the correct timezone ensures your workflows run at the intended local time.

 

Step 8: Advanced Scheduling Techniques

 

For more complex scheduling requirements, consider these advanced techniques:

Conditional Scheduling:

You can create workflows that only run under certain conditions by combining scheduler nodes with IF nodes:

  1. Start with a Scheduler or Cron node.
  2. Add an HTTP Request or similar node to fetch some data.
  3. Use an IF node to check conditions (e.g., is it a holiday?).
  4. Only proceed with the workflow if the conditions are met.

Dynamic Scheduling:

You can create workflows that dynamically adjust their own schedule:

  1. Create a workflow that includes a "Set" node to define a new schedule.
  2. Use the n8n API to update the workflow's own schedule.
  3. This allows for adaptive scheduling based on external factors.

Example code for a workflow that updates its own schedule using the n8n API:


// In a Function node
const newCronExpression = '0 0 10 _ _ \*'; // 10 AM daily

// Get the current workflow ID
const workflowId = $workflow.id;

// Prepare the request to update the workflow
const options = {
  method: 'PATCH',
  url: `https://your-n8n-instance/api/v1/workflows/${workflowId}`,
  headers: {
    'X-N8N-API-KEY': 'your-n8n-api-key',
    'Content-Type': 'application/json'
  },
  body: {
    settings: {
      timezone: 'UTC',
      cronExpression: newCronExpression
    }
  },
  json: true
};

// Return the options for an HTTP Request node to process
return {json: options};

 

Step 9: Schedule Monitoring and Alerting

 

For critical scheduled workflows, set up monitoring and alerting:

  1. Create a separate monitoring workflow that checks if your scheduled workflows executed successfully.
  2. Use the n8n API to fetch execution history.
  3. Set up notifications (email, Slack, etc.) if a scheduled workflow fails or doesn't run.

Example monitoring workflow structure:

  • Scheduler node (e.g., runs every hour)
  • HTTP Request node to call the n8n API and get recent executions
  • Function node to analyze execution data and identify missed schedules
  • IF node to check if any issues were found
  • Notification nodes (Email, Slack, etc.) to alert if issues are detected

 

Step 10: Best Practices for Scheduled Workflows

 

Follow these best practices for reliable scheduled workflows:

  • Error Handling: Include error handling nodes to manage failures gracefully.
  • Timeout Settings: Configure appropriate timeout settings for long-running workflows.
  • Documentation: Document the purpose and schedule of each workflow for team visibility.
  • Execution History: Regularly review execution history to identify patterns or issues.
  • Resource Consideration: Stagger schedules for resource-intensive workflows to prevent overloading your n8n instance.

Error handling example:

  1. Add an "Error Trigger" node to your workflow.
  2. Connect it to notification nodes (Email, Slack) to alert when errors occur.
  3. Include relevant error details in the notification.

 

Step 11: Troubleshooting Common Scheduling Issues

 

If your scheduled workflows aren't running as expected, check these common issues:

  • Workflow Not Active: Ensure the workflow is activated in the workflow settings.
  • Incorrect Cron Expression: Verify your cron syntax is correct.
  • Timezone Mismatch: Confirm you've selected the right timezone.
  • Server Issues: Check if the n8n server was down during the scheduled time.
  • Execution Conflicts: Look for overlapping executions of long-running workflows.

To debug scheduling issues:

  1. Check the "Executions" tab to see if and when the workflow ran.
  2. Review any error messages in the execution details.
  3. Test the workflow manually to ensure it works correctly.
  4. Verify the n8n queue is processing jobs properly.

 

Conclusion

 

Scheduling workflows in n8n provides powerful automation capabilities that can save time and ensure consistency in your processes. Whether you use the simple Scheduler node, the flexible Cron node, or the workflow settings approach, n8n offers multiple ways to automate your workflows based on time triggers. By following the steps and best practices outlined in this guide, you can create reliable, well-managed scheduled workflows that run exactly when you need them to.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022