Free n8n template

Weekly operations report n8n template

What it does

An importable n8n workflow that runs every Monday at 7am, reads six weeks of KPIs from a Postgres view, compares last week with the prior week, the four-week average and target, and stops if any KPI is missing. Claude writes a short narrative from the table, code rejects any number that is not in the table, and a manager approves in Slack before it goes to leadership. You need n8n, Postgres, an Anthropic API key, Slack and Gmail.

What this workflow does

  1. Every Monday 7am (Schedule Trigger) starts the run with a cron rule.
  2. Load weekly KPIs (Postgres) reads six weeks from a kpi_weekly view. A database error goes straight to the exceptions channel.
  3. Compare and flag (Code) finds last Monday-to-Sunday week, computes change against the prior week and the trailing four-week average, checks target, and flags moves above a 15% band. Any KPI with history but no value this week marks the data incomplete.
  4. Data complete? (If) blocks the report when a source is missing, which is the most important control in this workflow.
  5. Write narrative with Claude (HTTP Request) calls the Anthropic Messages API with a JSON schema: headline, 150 to 250 word narrative, flagged metrics covered and questions for leadership. The prompt forbids figures that are not in the table and unsupported causes.
  6. Verify numbers (Code) handles refusals and truncated output, then checks that every number in the text matches a KPI figure and that every flagged metric is mentioned.
  7. Manager approval in Slack waits up to eight hours for Send or Hold.
  8. Post report to leadership (Slack) and Email report (Gmail) deliver the approved version with the KPI table and a dashboard link.
  9. Post exception to Slack receives database errors, incomplete data, API failures and failed number checks.

Before you import

  • A Postgres database with a kpi_weekly view: kpi, label, unit, week_start (Monday), value, target, higher_is_better. Separate extract workflows load it from QuickBooks Online, your store, help desk and timesheets.
  • Written KPI definitions with an owner for each. The workflow reports numbers; it cannot fix a disputed definition.
  • An Anthropic API key. The template uses claude-opus-5-5; claude-haiku-5-5 is cheaper for high-volume, simple classification.
  • Slack review, leadership and exceptions channels, and a Gmail account for the email copy.

Setup

  1. Import the JSON and connect Postgres, Anthropic, Slack and Gmail credentials.
  2. Set the workflow time zone in Workflow settings, and TZ in Compare and flag to match.
  3. Adjust BAND and, if some KPIs must always appear, list them in REQUIRED_KPIS.
  4. Replace REPLACE_WITH_SLACK_REVIEW_CHANNEL_ID, REPLACE_WITH_SLACK_LEADERSHIP_CHANNEL_ID and REPLACE_WITH_SLACK_EXCEPTIONS_CHANNEL_ID.
  5. Replace REPLACE_WITH_LEADERSHIP_EMAIL on Email report and REPLACE_WITH_DASHBOARD_URL in Verify numbers.

Test it

Load twelve weeks of history and compare the KPI table in the Slack draft with the report your team built by hand for the same week. Then delete one KPI’s latest row and run again: the exceptions channel should say which metric is missing and nothing should reach leadership. Finally, edit a draft prompt to allow dates and confirm the number check blocks it.

Make it production-ready

  • Add a Friday form for department notes and pass them in place of “Manager notes: none supplied”, so the narrative can explain causes.
  • Store a business-day count per week and normalize volume KPIs for holiday weeks.
  • Save each approved report and KPI table to a history table so restated numbers are visible.
  • Set an n8n error workflow, and alert if the Monday run did not finish by 9am.
  • The Claude call tries up to three times. If the number check blocks often, tighten the prompt before loosening the check.

Read the full guide on automating weekly operations reporting for KPI definitions and backfill, or ask Lumeor for help wiring the extracts.

Next steps