Systems Library / Operations & Admin / How to Automate Employee Anniversary and Birthday Recognition
Operations & Admin hr people

How to Automate Employee Anniversary and Birthday Recognition

Send personalized recognition messages for birthdays and work anniversaries.

Jay Banlasan

Jay Banlasan

The AI Systems Guy

Remembering every employee's birthday and work anniversary does not scale. I built a system to automate employee recognition for anniversaries and birthdays that sends personalized messages, posts in Slack, and tracks milestones without anyone maintaining a spreadsheet.

Small recognition moments add up. This system makes sure none get missed.

What You Need Before Starting

Step 1: Set Up the Employee Database

import sqlite3

def init_recognition_db(db_path="recognition.db"):
    conn = sqlite3.connect(db_path)
    conn.execute("""
        CREATE TABLE IF NOT EXISTS employees (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            name TEXT,
            email TEXT,
            slack_id TEXT,
            birthday TEXT,
            hire_date TEXT,
            department TEXT,
            manager_name TEXT
        )
    """)
    conn.execute("""
        CREATE TABLE IF NOT EXISTS recognition_log (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            employee_id INTEGER,
            event_type TEXT,
            message_sent TEXT,
            sent_at TEXT
        )
    """)
    conn.commit()
    return conn

Step 2: Find Today's Celebrations

from datetime import datetime

def get_todays_celebrations(conn):
    today_md = datetime.now().strftime("%m-%d")
    celebrations = []

    # Birthdays
    rows = conn.execute(
        "SELECT id, name, slack_id, department FROM employees WHERE substr(birthday, 6) = ?",
        (today_md,)
    ).fetchall()
    for row in rows:
        celebrations.append({"id": row[0], "name": row[1], "slack": row[2],
                           "dept": row[3], "type": "birthday"})

    # Work anniversaries
    rows = conn.execute(
        "SELECT id, name, slack_id, department, hire_date FROM employees WHERE substr(hire_date, 6) = ?",
        (today_md,)
    ).fetchall()
    for row in rows:
        hire_year = int(row[4][:4])
        years = datetime.now().year - hire_year
        if years > 0:
            celebrations.append({"id": row[0], "name": row[1], "slack": row[2],
                               "dept": row[3], "type": "anniversary", "years": years})

    return celebrations

Step 3: Generate Personalized Messages

import anthropic

client = anthropic.Anthropic()

def generate_message(celebration):
    if celebration["type"] == "birthday":
        prompt = f"Write a short, warm birthday message for {celebration['name']} from the {celebration['dept']} team. Keep it to 2 sentences. No corporate speak. Sound genuine."
    else:
        prompt = f"Write a short work anniversary message for {celebration['name']} celebrating {celebration['years']} years with the company. Keep it to 2 sentences. Mention the milestone. Sound genuine."

    message = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=200,
        messages=[{"role": "user", "content": prompt}]
    )
    return message.content[0].text

Step 4: Post to Slack

import requests

def post_celebration(slack_token, channel, celebration, message):
    emoji = "🎂" if celebration["type"] == "birthday" else "🎉"

    if celebration["type"] == "birthday":
        header = f"{emoji} Happy Birthday, {celebration['name']}!"
    else:
        header = f"{emoji} {celebration['name']} - {celebration['years']} Year Anniversary!"

    payload = {
        "channel": channel,
        "blocks": [
            {"type": "header", "text": {"type": "plain_text", "text": header}},
            {"type": "section", "text": {"type": "mrkdwn", "text": message}}
        ]
    }

    requests.post("https://slack.com/api/chat.postMessage",
                  headers={"Authorization": f"Bearer {slack_token}"},
                  json=payload)

Step 5: Run Daily and Log

def run_daily_recognition(conn, slack_token, channel):
    celebrations = get_todays_celebrations(conn)

    for celebration in celebrations:
        message = generate_message(celebration)
        post_celebration(slack_token, channel, celebration, message)

        conn.execute(
            "INSERT INTO recognition_log (employee_id, event_type, message_sent, sent_at) VALUES (?,?,?,?)",
            (celebration["id"], celebration["type"], message, datetime.now().isoformat())
        )

    conn.commit()
    print(f"Sent {len(celebrations)} recognition messages")

# Schedule: run at 9am daily
# 0 9 * * * python3 /path/to/recognition.py

What to Build Next

Add milestone-specific recognition: 1 year, 5 years, 10 years with escalating rewards. Connect to a gift card API for automatic birthday gifts. The messages are the minimum. Tangible recognition at milestones is the next step.

Related Reading

Want this system built for your business?

Get a free assessment. We will map every system your business needs and show you the ROI.

Get Your Free Assessment

Related Systems