DEV Community

berthelius
berthelius

Posted on • Originally published at frihet.io

Automate Your Invoicing with Claude Code + n8n + a REST API

The average freelancer spends 5-8 hours per month on admin tasks that a computer could handle in seconds: sending payment reminders, classifying expenses, generating reports. These tasks aren't difficult. They just shouldn't require your attention.

Here's how I automated 80% of my business admin with three tools: an ERP with a REST API (Frihet), an AI assistant (Claude Code), and a workflow automator (n8n). No coding required.

The Three Pieces

Your ERP — Where invoices, clients, expenses live. The critical requirement: it must have a REST API and webhooks. Without these, automation is impossible. Most ERPs don't offer both.

n8n — Visual workflow automator. If X happens, then do Y. Open source, self-hostable, drag-and-drop.

Claude Code + MCP — AI assistant that can interact with your ERP directly through the MCP protocol. You talk, it executes.

All three have free tiers.

Automation 1: Payment Reminders (ROI: Immediate)

The most profitable automation. Unpaid invoices without reminders = money that arrives late or never.

Flow

Invoice becomes overdue (webhook)
    → Wait 3 days (grace period)
    → Check: still unpaid? (API call)
    → Yes → Email reminder to client
    → Wait 7 more days
    → Still unpaid? → Second reminder (firmer tone)
    → Wait 8 more days
    → Still unpaid? → Notify YOU via Telegram
Enter fullscreen mode Exit fullscreen mode

n8n Setup (5 nodes)

  1. Webhook Trigger — Receives invoice.overdue event with invoice ID, client, amount, due date
  2. Wait (3 days) — Grace period
  3. HTTP RequestGET /v1/invoices/{id} to check if still unpaid
  4. Send Email — "Reminder: Invoice [number] pending payment" with payment link
  5. If/Else — Second reminder at day 10, personal notification at day 15

The tone progression matters:

  • Day 3: Informational ("We'd like to remind you...")
  • Day 10: Direct ("This invoice has been overdue for 10 days")
  • Day 15: For you ("Take action on this one")

Automation 2: Weekly Financial Summary

Every Monday at 9:00 you receive your business metrics. No dashboards, no spreadsheets.

Flow

Cron: Monday 9:00
    → GET /v1/invoices?date_from=last_monday
    → GET /v1/expenses?date_from=last_monday
    → Calculate: issued, collected, pending, expenses, net
    → Format message
    → Send via Telegram/Email
Enter fullscreen mode Exit fullscreen mode

Data Included

  • Invoices issued this week (count + total)
  • Payments received
  • Total pending collection
  • Expenses recorded
  • Net balance (collected - expenses)
  • Urgent: invoices due this week

This flow only uses GET endpoints — reads data, presents it usefully.

Automation 3: Stripe → Invoice (Auto)

If you collect via Stripe, invoices should create themselves.

Stripe payment_intent.succeeded (webhook to n8n)
    → Extract: client email, amount, description
    → Lookup client in ERP by email
    → Client not found? → Create client
    → Create invoice with payment data
    → ERP sends invoice to client automatically
Enter fullscreen mode Exit fullscreen mode

Result: Client pays on your website → receives invoice in email in under a minute → invoice recorded in ERP with tax compliance. Zero human intervention.

Claude Code + MCP: The AI Layer

With an MCP server, Claude Code interacts directly with your ERP:

You: "Create an invoice for Company ABC for 3 hours
      of consulting at 80 EUR/hour, with 21% VAT"

Claude: [calls create_invoice via MCP]
→ Looks up "Company ABC" in your database
→ Creates invoice: 3 × 80 EUR + 21% VAT = 290.40 EUR
→ Confirms details
Enter fullscreen mode Exit fullscreen mode

No copy-pasting. No opening the ERP. No calculating VAT.

Other things Claude can do via MCP:

  • Query current month's invoicing
  • List invoices pending payment
  • Create quotes for clients
  • Search clients by name or tax ID
  • Generate expense reports

Why Most ERPs Can't Do This

Automation requires three things:

  1. Open API — Many ERPs charge extra for API access or don't offer one at all
  2. Real webhooks — Events that fire in real-time (not polling)
  3. MCP server — For native AI assistant integration

Without all three, you're stuck with manual work or fragile workarounds.

Start With One

Don't set up everything at once. Pick the automation that saves you the most time — for most freelancers it's payment reminders — and configure it this week.

Once it works, add the next. Within a month, 80% of your admin runs on its own.


I'm building Frihet — an ERP with a REST API, 14 webhook events, and an MCP server. If you want to try these automations: app.frihet.io (free plan). The MCP server is open source: github.com/berthelius/frihet-mcp

Top comments (0)