Xero financial data transformed into weekly email and Slack reports

Automated Weekly Financial Reports from Xero via n8n

Stanislav Kapustin May 1, 2026 case study · automation · n8n · xero · financial reporting · slack

Case summary

Quick scan before the full breakdown.

Goal

Deliver a weekly financial pulse to directors without manual Xero exports or spreadsheet formatting.

Stack

n8n, Xero API, Gmail API, Slack, JavaScript

Result

14 of 14 weekly reports delivered on schedule, with directors using the summary more consistently than the old PDFs.

Time saved

Saved the finance manager about 45-60 minutes every Monday.

An n8n workflow that pulls live financial data from Xero every Monday at 07:00, generates a structured P&L, cash flow summary, and budget variance report, and delivers it to the right people via email and Slack — without anyone opening Xero or running a manual export.


The Problem

A UK-based service business with around £80K monthly revenue was using Xero for all accounting. Their management team — three directors — wanted a weekly financial pulse without logging into Xero themselves. The finance manager was spending about an hour every Monday morning pulling the same three reports, formatting them in Excel, and emailing a PDF to the directors.

The reports were always the same structure. The data was always in Xero. The hour spent was pure mechanical work.

They asked whether the Monday morning report could just arrive in their inbox by itself.


What I Built

One n8n workflow triggered on a CRON schedule: every Monday at 07:00 UTC.

Step 1 — Authenticate with Xero

Xero uses OAuth2 with short-lived access tokens (30-minute expiry). n8n’s Xero node handles token refresh automatically using the stored refresh token. The workflow starts by verifying the connection is live before pulling any data.

Step 2 — Pull financial data

Three parallel branches fetch data simultaneously to keep total runtime under 15 seconds:

  • P&L: GET /api.xro/2.0/Reports/ProfitAndLoss with fromDate (first day of current month) and toDate (yesterday). Also fetches the same period for the prior year for comparison.
  • Cash flow: GET /api.xro/2.0/BankTransactions for the past 7 days, grouped by account. Alongside this, fetches /api.xro/2.0/Invoices?Statuses=AUTHORISED to show total outstanding receivables.
  • Budget variance: GET /api.xro/2.0/Reports/BudgetSummary — requires that the client has a budget set up in Xero, which this client did. Returns actuals vs budget by account for the current financial year to date.

Step 3 — Transform and calculate

Xero’s API responses are XML-like JSON with nested Rows arrays. A JavaScript node in n8n flattens these into clean key-value objects and calculates derived metrics:

  • Gross margin % (revenue minus direct costs divided by revenue)
  • Operating expense ratio (opex as % of revenue)
  • Budget variance % per major category
  • Week-over-week cash movement
  • Outstanding debtors aged over 30 days

Step 4 — Generate the report

The transformed data is fed into an HTML template stored as an n8n variable. The template produces a clean, table-based email that renders correctly in Gmail, Outlook, and Apple Mail — tested across all three.

The email includes:

  • Header: week ending date, total revenue MTD, and a one-line status (green/amber/red based on whether revenue is within 10% of budget)
  • P&L summary: revenue, gross profit, operating expenses, and net profit for the month to date vs. prior year same period
  • Cash position: current bank balance, net cash movement this week, total outstanding receivables
  • Budget variance table: top 5 over-budget and top 5 under-budget line items
  • Outstanding invoices: any invoice overdue by more than 14 days, with client name and amount

Step 5 — Deliver

The HTML email is sent via Gmail API (using the finance manager’s account as sender) to a distribution list of three directors. Simultaneously, a condensed Slack message posts the key numbers to a private #finance channel — for the directors who check Slack before email in the mornings.


The Budget Variance Problem

Xero’s BudgetSummary endpoint returns data only if the selected financial year has a budget. If the budget isn’t set up, or if it’s a new financial year and the budget hasn’t been entered yet, the endpoint returns an empty response.

Rather than let this silently produce a broken report, the workflow checks whether the budget response contains data before building the variance section. If it doesn’t, the email replaces the variance table with a single line: “Budget data not available for this period. Please update the budget in Xero.” The directors requested this explicit flag rather than a hidden empty section.


Results

Running for 14 weeks:

  • 14 of 14 reports delivered on schedule, without manual intervention
  • Finance manager time saved: approximately 45–60 minutes every Monday
  • Directors report they now actually read the weekly summary, where previously they often didn’t open the PDF attachments
  • One director caught an over-budget contractor line in week 3 that would likely have gone unnoticed until the monthly review — saved the business a conversation about scope creep before it got worse
  • Total setup time: about 6 hours including Xero OAuth2 setup, template design, and testing across email clients

What I’d Do Differently

The HTML email template lives as a raw string in an n8n variable, which is awkward to maintain. A better approach is storing the template as a file on the VPS and reading it at runtime — easier to edit without touching the workflow itself.

The Slack message is a flat text block. Interactive Slack blocks with expand/collapse sections would let the directors drill into specific numbers without opening the email, which would make the Slack version genuinely useful rather than just a notification.


Stack

  • n8n (self-hosted)
  • Xero REST API — P&L, cash flow, budget, bank transactions, invoices
  • Gmail API — report delivery
  • Slack — condensed weekly summary
  • JavaScript (n8n Code node) — data transformation and metric calculation

Want weekly financial reports delivered automatically from Xero, QuickBooks, or another accounting system? Get in touch.

More cases

Three nearby case studies worth reading next.

Need a similar system in your business?

If you have a manual workflow between tools, I can help map the logic, design the system, and automate it in a way your team can actually use.

svg