## Introduction
Employee anniversaries are important milestones that help boost morale, improve retention, and foster a positive company culture. However, manually tracking these dates and notifying HR teams can be time-consuming and error-prone, especially as a company grows. Automating this process ensures timely reminders, reduces manual overhead, and enables HR to prepare personalized celebrations or recognitions.
In this article, we’ll build a robust automation workflow using **n8n**, an open-source workflow automation tool, to automatically notify HR of upcoming employee anniversaries. This workflow will integrate with **Google Sheets** (where employee data is stored), trigger monthly checks for upcoming anniversaries, and send notifications to **Slack** or **Email** for HR’s awareness.
This guide is practical, detailed, and designed for startup CTOs, automation engineers, and operations specialists looking to build scalable HR automation.
—
## What Problem Does This Automation Solve?
– Eliminates manual HR tracking of employee anniversary dates.
– Proactively notifies HR ahead of time to plan celebrations, gifts, or announcements.
– Reduces risk of missing important dates, improving employee morale.
– Scales seamlessly as employee count increases.
___
## Tools and Services Integrated
– **n8n**: Workflow automation platform.
– **Google Sheets**: Storage of employee data including hire dates.
– **Slack** (optional): Channel notifications for HR.
– **SMTP Email** (optional): Email notifications to HR.
Alternatively, you could substitute Slack or Email nodes depending on your org’s preferred communication channels.
—
## Pre-requisites
1. **Google Sheet with employee data:**
   – At minimum, columns for Employee Name, Email (optional), Hire Date.
   – Dates in ISO format (YYYY-MM-DD) or any consistent date format.
2. **n8n instance:** Set up on cloud or locally.
3. **Slack workspace** with incoming webhook or bot token if Slack notifications are desired.
4. **SMTP account or company email** configured in n8n for email notifications.
—
## Overview of the Workflow
1. **Trigger**: Schedule trigger to run monthly on a specific day.
2. **Fetch Data**: Read all employee records from Google Sheets.
3. **Process Data**: Calculate upcoming anniversaries within a configurable window (e.g., next 7 days).
4. **Filter**: Only employees with anniversaries coming up are passed forward.
5. **Message Preparation**: Format the notification message.
6. **Notify HR**:
   – Send message to Slack channel.
   – (Optional) Send email notification.
—
## Step-by-Step Tutorial
### Step 1: Prepare Your Google Sheet
– Create a Google Sheet named e.g., “Employee Data”.
– Include columns:
  – `Name` (text)
  – `Email` (text, optional)
  – `HireDate` (date, ISO format preferably)
Example rows:
| Name         | Email             | HireDate   |
|————–|——————-|————|
| Alice Brown  | alice@company.com | 2021-07-15 |
| Bob Smith    | bob@company.com   | 2019-08-01 |
Ensure your Google Sheet is accessible via Google API with the correct permissions.
—
### Step 2: Configure n8n Google Sheets Node
– In n8n, create a new workflow.
– Add a **Google Sheets** node.
– Authenticate using OAuth or credentials with access to your spreadsheet.
– Set Operation to `Read Rows`.
– Select your spreadsheet and worksheet.
This node will fetch all rows for processing.
—
### Step 3: Add Schedule Trigger
– Add a **Schedule** trigger node.
– Configure it to run monthly, e.g., **Day 1 of every month at 9:00 AM**.
This ensures the workflow checks for anniversaries once per month.
—
### Step 4: Calculate Upcoming Anniversaries
– Add a **Function** node after the Google Sheets node.
– This node will iterate over employee rows and calculate if their anniversary is within the next 7 days.
Sample JavaScript logic inside the Function node:
“`javascript
const today = new Date();
const daysAhead = 7;
const upcoming = items.filter(item => {
  const hireDate = new Date(item.json.HireDate);
  if (isNaN(hireDate)) return false; // Skip invalid dates
  // Create anniversary date for this year
  let anniversary = new Date(today.getFullYear(), hireDate.getMonth(), hireDate.getDate());
  // If anniversary already passed this year, check next year
  if (anniversary < today) {
    anniversary.setFullYear(today.getFullYear() + 1);
  }
  // Calculate difference in days
  const diffTime = anniversary - today;
  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
  return diffDays <= daysAhead && diffDays >= 0;
});
return upcoming;
“`
This filters employees with anniversaries coming up within 7 days of the workflow run.
—
### Step 5: Format Notification Message
– Add a **Set** node or another **Function** node.
– Here, format a message summarizing who has an upcoming anniversary and when their hire date anniversary will be.
Example message formatting:
“`javascript
const messages = items.map(item => {
  const name = item.json.Name;
  const hireDate = new Date(item.json.HireDate);
  const yearDiff = new Date().getFullYear() – hireDate.getFullYear();
  const anniversaryDate = new Date(new Date().getFullYear(), hireDate.getMonth(), hireDate.getDate());
  return `*${name}* has a work anniversary on ${anniversaryDate.toLocaleDateString()} celebrating ${yearDiff + 1} years.`;
});
return [
  {
    json: {
      notification: messages.join(‘\n’)
    }
  }
];
“`
This creates a nicely formatted message listing all upcoming anniversaries.
—
### Step 6: Notify HR via Slack
– Add a **Slack** node.
– Connect it to the previous node.
– Choose the Operation `Post Message`.
– Set the channel (e.g., `#hr-announcements`).
– Use the `{{ $json.notification }}` expression for the message text.
Make sure to authenticate the Slack node with appropriate permissions to post messages.
—
### Step 7 (Optional): Notify HR via Email
– Add an **Email Send** node.
– Use your SMTP credentials.
– Set:
  – To: HR distribution list or mailing address.
  – Subject: “Upcoming Employee Anniversaries”
  – Body: Use `{{ $json.notification }}` from previous node.
—
### Step 8: Handle Empty Results
– To avoid sending empty notifications when no anniversaries occur, add an **IF** node after the Function node that filters upcoming anniversaries.
– Condition: Check if the number of items > 0.
– Only proceed to Slack or Email node when condition is true.
—
## Common Errors and Tips
– **Date format mismatches:** Ensure hire dates are in a consistent, parseable format. ISO 8601 (YYYY-MM-DD) is preferred.
– **Time zone discrepancies:** Consider users’ and server time zones when calculating days difference.
– **Authentication issues:** Double-check API credentials for Google Sheets and Slack.
– **Empty notifications:** Always guard your notification nodes with condition nodes to avoid spamming empty messages.
– **Scaling:** For a large employee roster, consider pagination or incremental data fetch to avoid API throttling.
—
## How to Adapt and Scale This Workflow
– **Frequency:** Change schedule trigger frequency to weekly or daily if more granular notifications are needed.
– **Additional Data:** Enrich messages with employee roles, departments, or manager info by expanding your Google Sheet.
– **Other Channels:** Add integrations with Microsoft Teams, Asana, or SMS gateways for multi-channel notifications.
– **Custom Anniversary Types:** Track milestones like 5-year or 10-year anniversaries with conditional logic and customized celebratory messages.
– **Logging:** Add an operation node to log notification success/failure for audit trails.
—
## Summary
This guide demonstrated how to automate notifications to HR about upcoming employee anniversaries using n8n by integrating Google Sheets, scheduling triggers, and messaging through Slack and email. The automation reduces manual tracking, ensures timely reminders, and improves company culture effortlessly.
### Bonus Tip
To further personalize engagement, incorporate a personalized gift list or recognition workflow triggered alongside this anniversary reminder. For example, automatically create recognition tasks in your project management tool or send personalized e-cards through integration with Mailchimp or SendGrid.
By continually expanding this automation, startups and operations teams can scale thoughtful employee recognition with minimal overhead.
—
Feel free to clone and customize this workflow in your n8n instance and adapt it to your organization’s HR processes.