Late payments kill cash flow. For a 4-person creative agency we worked with, 30% of invoices sat unpaid past 30 days — not because clients were broke, but because everyone was busy and the follow-up emails kept falling through the cracks.
Here's exactly how we automated it using OpenClaw + a few API calls, in under 2 hours.
The Problem
The agency used FreshBooks for invoicing. Their process for following up:
- Check overdue invoices manually (usually forgotten)
- Compose a polite email from scratch each time
- Send it, log a note somewhere
- Forget to follow up again
Three weeks of silence later: a panicked Slack message to the client, an awkward invoice bump, a damaged relationship.
The Solution: A Lightweight Automation Pipeline
No third-party tools beyond what they already had. Here's the stack:
- FreshBooks API — pull overdue invoices
- OpenClaw agent — orchestrate the workflow
- Resend — send personalized follow-up emails
- Google Sheets — log what was sent (low-fi audit trail)
Step 1: Pull Overdue Invoices
FreshBooks has a clean REST API. A simple GET request pulls all outstanding invoices filtered by due date:
curl "https://api.freshbooks.com/accounting/account/{ACCOUNT_ID}/invoices/invoices?search[status]=outstanding&search[date_max]=2026-04-03" -H "Authorization: Bearer $FRESHBOOKS_TOKEN"
The response gives you: client name, email, invoice number, amount, due date. That is all you need.
Step 2: Build the Follow-Up Logic
Not every overdue invoice needs the same treatment. We built a simple tiered approach:
| Days Overdue | Action |
|---|---|
| 1-7 | Gentle nudge ("just checking in") |
| 8-14 | Firmer note, mention invoice number |
| 15-30 | Flag for human review, send one more |
| 30+ | Escalate to founder manually |
The agent checks the delta between today and the invoice due date, then picks the right template. No hardcoded copy — each email is personalized with the client name, invoice amount, and a link.
Step 3: Generate the Email
We used the AI to write a contextually appropriate email, not a generic template:
Client: Coastal Design Studio
Invoice: #1042 — $3,200
Days overdue: 9
Tone: professional but warm, 3 sentences max
Output:
Hi Sarah, hope the week is going well! Just circling back on Invoice #1042 for $3,200 — it came due on March 25th. Let me know if anything has come up or if you need a different payment method. Happy to help sort it.
The key: it reads like a human wrote it. Not a dunning notice from a SaaS product.
Step 4: Send via Resend
curl -X POST https://api.resend.com/emails -H "Authorization: Bearer $RESEND_KEY" -H "Content-Type: application/json" -d "{"from": "billing@theiragency.com", "to": ["sarah@coastaldesign.co"], "subject": "Quick check-in on Invoice #1042", "html": "<p>Hi Sarah...</p>"}"
One API call. Done.
Step 5: Log It
We appended each sent email to a Google Sheet via their Sheets API — date, client, invoice number, amount, tier used. Simple audit trail the owner could glance at on Fridays.
Results (After 6 Weeks)
- Average days-to-payment dropped from 28 to 14
- Zero missed follow-ups
- Founder spent 0 minutes on invoice chasing (down from ~2 hours/week)
- One slightly awkward email where the AI was too casual — we tightened the prompt for the 15+ day tier
What Makes This Work
The automation is not clever. It is consistent. The agency real problem was not writing follow-up emails — it was remembering to do it every single time, with no exceptions.
That is what agents are good at: boring consistency at scale.
If you are running a service business and chasing invoices manually, this is a 2-hour project with a very measurable ROI. The FreshBooks API is well-documented, Resend is free up to 3,000 emails/month, and you can prototype the whole thing before committing a single line to production.
We build these automations at Anythoughts.ai — AI agents for real business operations. Follow along as we build in public.
Top comments (0)