TUTORIAL 1
โฐ

Holiday Countdown Bot

Posts "X days until Christmas!" to email daily. A perfect first automation to learn scheduling, branching logic, and testing strategies.

Video thumbnail
Watch the Walkthrough

Workflow Overview

Schedule
Config
IF
Gmail

This workflow triggers every morning, checks if today is between Dec 1st and Dec 25th, calculates the days remaining, and sends an email. It uses a configuration node to allow for easy testing without waiting for the actual date.

📋

Step-by-Step Guide

1

Create Workflow & Manual Trigger

Start with a Manual Trigger to build and test logic before automating. This is best practice for all new workflows.

2

Config Node (Test Mode)

Add an "Edit Fields" node. Create boolean is_test, and number fields test_month (12) and test_day (e.g. 20).

3

Resolve Dates Node

Add another "Edit Fields" node. Use expressions to set current_day and current_month. This is where we swap between real time and test time.

4

IF Node (Date Range Check)

Filter logic: month = 12 AND day <= 25. Only continue if true.

5

Gmail Node

Authenticate your account. Subject: "Daily Countdown". Body: Calculate 25 - day in an expression.

6

Add Schedule Trigger

Replace manual trigger with Schedule Trigger. Use Cron Mode: 0 9 1-25 12 * to run at 9am only on Dec 1-25.

7

Test & Go Live

Set is_test to false. Activate the workflow toggle in the top right.

💻

The Code

{{ $json.is_test ? $json.test_day : $now.day }}
{{ $json.is_test ? $json.test_month : $now.month }}
{{ 25 - $json.current_day }} days until Christmas!
0 9 1-25 12 *
💡

Key Concepts

๐Ÿ”„ Cron Expressions

Format: Minute Hour Day Month Weekday. Precise scheduling control.

โ“ Ternary Operator

Syntax: cond ? true : false. Essential for inline IF logic in n8n.

๐Ÿ”ข Strings vs Numbers

Comparisons like "12" > 10 can fail. Always ensure types match.

๐Ÿงช Test Mode Pattern

Building a toggle allows you to simulate future dates without waiting.

โšก Execution Limits

Scheduling triggers strictly for needed times saves your monthly execution quota.

Ready for the next automation?

You've mastered this one. Now let's add some more skills to your toolkit.

Next: Holiday Joke & Fact Convo Starter