PROJECT 001 · AMBERLABS · 2026 · LIVE
KSeF Cost Radar
A weekly cost report for a small business, built automatically from purchase invoices in KSeF, Poland's national e-invoicing system.
- nodes in the main workflow
- 79
- JavaScript Code nodes
- 20
- workflows
- 3
- first live report
- 16.11.2026
00 · Summary
- CLIENT
- Owner of a small hospitality business
- MY ROLE
- Technical co-founder: discovery, system design, build, launch and support. My business partner reviewed every technical decision.
- TIMELINE
- Customer interview in September 2026, about five weeks of building in October and November, first live report on 16 November 2026.
- STACK
- n8n Cloud, KSeF API v2, OpenAI API, Google Sheets, Gmail, Telegram Bot API, one static web page
- STATUS
- Live. Runs every Monday.
01 · Problem
The data was there. Nobody had time to read it.
The owner tracked costs by hand in a notebook, about an hour a day. Overspending only showed up after the month had ended.
Since 2026 most purchase invoices in Poland go through KSeF, with every line item in structured XML. The information already existed, line by line. The problem was time and attention.
02 · Discovery
Start with the person, not the tool.
Before any technology, I ran a customer interview using The Mom Test: questions about what the owner does today and what it costs them, not "would you like an app that…".
The owner doesn't need a dashboard. They need one clear message, once a week, where they already are.
That became four rules before the first node was built:
- No new app, no login, no spreadsheets. Email, a short phone message and one web page.
- Explain, don't just show. Every alert says which item, which supplier and how much more.
- Client data stays private. AI sees as little as possible.
- Never send something wrong. A human checks every report, without making the client wait.
03 · What it does
Every Monday, from 5:00 to 8:00.
- 05:00DownloadLogs in to the KSeF API and downloads last week's purchase invoices.
- ParseTurns every FA(3) XML invoice into line items. Corrections, foreign currencies and gross prices all become net amounts in PLN.
- ClassifyFood, cleaning, laundry, fixed costs, other. Known items come from memory. Only new items go to AI.
- ComputePlain code: totals per category, a typical week and alerts with reasons.
- 08:00SendAfter approval: an email, a short Telegram message and a web page with the full report.
alert ⇐ cost_week vs median(last 4 weeks)
On the web page the owner can mark any invoice as "don't count", for example a private purchase. Totals and alerts recalculate instantly, also for past weeks.
- 1typical week = median of the last 4 weeks
- 2alerts explain why: item, supplier, amount
- 3arrives Monday 08:00 · email + Telegram
04 · Architecture
Three workflows, one system.
| WORKFLOW | NODES | WHAT IT DOES |
|---|---|---|
| Radar | 79 | KSeF, parsing, categories, weekly calculation, approval, sending, saving |
| Page API | 21 | One webhook for the web page: 8 weeks of data, exclude or restore an invoice |
| Alerts | 4 | Any failed node sends the step, error and time to the team |
05 · Engineering decisions
D-01 · AI does one job only. It picks a category for new line items. It never calculates, never writes report text and never sees amounts. Answers are checked against a closed list, and anything outside it becomes "other". If AI fails three times, the report still goes out on time.
D-02 · Privacy by design. The KSeF token is read-only and the client can revoke it at any time. The Telegram message shows totals only.
Sent to AI
{"id": 1, "nazwa": "Jaja L 30 szt."}
Never sent
- tax ID
- supplier
- amount
D-03 · A human checks every report, without becoming a bottleneck. At 5:00 the report reaches us with two buttons, "send at 8:00" or "hold". No click by 8:00 means it goes out automatically, and we get a notice.
D-04 · Safe to run twice. Invoices are de-duplicated by KSeF number. A week that was already sent never goes out again. The week is saved only after sending, so an interrupted run leaves no half-written data.
D-05 · Same numbers everywhere. The email and the web page use the same calculation. Without exclusions they match to the grosz, checked on five test weeks.
D-06 · Fails loudly. KSeF down, AI failing, Telegram not delivering, empty weeks: each case has its own handling and its own message to the team.
D-07 · Respects API limits. KSeF allows 16 downloads a minute and 64 an hour, so downloads run every 5 seconds with retries. A backfill mode loads past weeks for a new client without sending anything.
06 · Testing
- Correction invoices
- EUR invoice
- gross-price invoices
- empty week
- KSeF outage
- AI outage and invalid answers
- double run
- no click on approval
- "hold"
- Telegram failure
- web page on Safari, Chrome, Android and iPhone
- email vs page totals on five test weeks
07 · Delivery and result
- Written spec first: five versions of the technical report, reviewed by my business partner.
- Built next to a full-time job: about five weeks, around two hours a day.
- Fitted to the owner's routine: a weekly report on the phone, ready to forward.
- Support after launch: fixes and changes based on feedback.
The notebook is gone. The owner saves 2–5 hours a week.
KSeF Cost Radar is a commercial AmberLabs product, so the code is private. I'm happy to walk you through the live system.