Kimai - Project Deadline Monitor — Daily Email Report via n8n

:date: Kimai Project Deadline & Budget Monitor — Daily Email Alert

Automatically get notified every morning when a billable project is approaching its deadline or burning through its hours budget.


:puzzle_piece: What This Workflow Does

This workflow runs every weekday at 9:00 AM, queries your Kimai time-tracking instance, and sends a formatted HTML digest email whenever one or more billable projects need your attention — either because their end date is near, or because their hour budget is running low.

If nothing requires attention that day, no email is sent.


:sparkles: Features

  • :alarm_clock: Scheduled daily — runs Monday–Friday at 9:00 AM (fully configurable)

  • :magnifying_glass_tilted_left: Filters billable projects only — ignores non-billable work

  • :tear_off_calendar: Deadline tracking — alerts when a project ends within a configurable number of days (default: 10 days)

  • :money_bag: Budget tracking — alerts when logged hours exceed 80% of the project’s time budget

  • :vertical_traffic_light: Color-coded urgency levels — expired, urgent, warning, on track, or missing data

  • :e_mail: Rich HTML email — includes deadline status, a visual progress bar for hours, and a direct link to your Kimai instance

  • :bell_with_slash: Silent on quiet days — the email is only sent when at least one project requires attention


:counterclockwise_arrows_button: Workflow Steps

Schedule Trigger (9 AM, Mon–Fri)
    └── GET /api/projects (visible only)
        └── Filter: billable === true
            ├── GET /api/projects/:id        ← project details (end date, budget, customer)
            └── GET /api/timesheets          ← all time entries per project
                └── Sum total seconds per project
                    └── Merge details + totals (by project ID)
                        └── Calculate urgency & filter reportable projects
                            └── [IF count > 0]
                                └── Build HTML email
                                    └── Send via SMTP


:bar_chart: Alert Logic

A project appears in the report if at least one of these conditions is true:

Condition Threshold
Days until project end ≤ 10 days (configurable)
Budget consumption ≥ 80% of time budget

Urgency Levels

Level Trigger Color
:police_car_light: EXPIRED End date is in the past Red
:fire: URGENT ≤ 3 days remaining Orange
:hourglass_not_done: WARNING ≤ 7 days remaining Amber
:white_check_mark: OK ≤ 10 days remaining Green
:magnifying_glass_tilted_left: MISSING DATA No end date set Indigo

:gear: Setup & Configuration

Requirements

  • A running Kimai instance with API access

  • A Bearer token for a Kimai service account

  • SMTP credentials for sending email

  • n8n (self-hosted or cloud)

Credentials to configure

Node Credential Type Notes
GET Projects HTTP Bearer Auth Kimai service account token
GET Projects Details HTTP Bearer Auth Same token
GET Timesheet Records HTTP Bearer Auth Same token
Send an Email SMTP Your mail server credentials

Customization

Change the alert window (days threshold) Open the Calculate expiration Code node and edit line 1:

const daysThreshold = 10; // Change to your preferred number of days

Change the budget alert threshold In the same node, find getBudgetInfo() and edit:

shouldReport: percentage >= 80  // Change 80 to your preferred percentage

Change the schedule Edit the Every Day at 9:00 Schedule Trigger node. The default cron expression 0 9 * * 1-5 runs at 9 AM Monday–Friday.

Change email sender / recipient Update the Send an Email node fields: fromEmail and toEmail.

Update the Kimai URL Replace https://kimai with your actual Kimai instance URL in all three HTTP Request nodes and in the Open Timesheet button link inside Build Email HTML - Report.


:framed_picture: Email Preview

The generated email includes one card per project, showing:

  • Customer name and project name

  • Order Deadline (PO) — date, urgency badge, and days remaining

  • Hours Monitoring — visual progress bar with used/total hours and percentage

If a project has no end date or no budget configured, the card highlights it clearly so you can act on it.


:memo: Notes

  • Timesheet records are fetched with size=1000000000 to retrieve all entries in a single call. For very large datasets, consider paginating or filtering by date range.

  • Dates are displayed in DD/MM/YYYY format. This can be adjusted in the formatIsoToItalian() function inside the Calculate expiration node.

  • The workflow uses enrichInput1 merge mode — project detail fields take precedence, and budget totals are appended.

Workflow Code: