How we Automated our Vendor Bill Processing with OpenClaw + Zoho Books — and the AI Even Handled a Credit Note Without Training
Running a small business means wearing every hat — including the finance one. For years, processing supplier invoices was a tedious weekly chore: download PDFs from email, open Zoho Books, create a new bill, pick the right nominal code, attach the PDF, repeat. With 10+ suppliers sending invoices every month, this easily consumed an hour or more each week. And we were getting it wrong — wrong nominal codes, missed attachments, manual data entry errors.
Today, our invoices are processed automatically. An AI agent monitors our email, reads the PDFs, creates draft bills in Zoho Books with the correct accounts and tax codes, attaches the original PDFs, and moves the emails to a “Processed” folder. We just review and approve.
Here’s how we built it — and the subtle edge-cases we had to solve along the way.
The Architecture: OpenClaw + Zoho Books
The setup uses OpenClaw as the orchestration layer — an open-source AI agent framework that can run scheduled tasks, manage state, and execute multi-step workflows using natural language instructions. It connects to:
•Microsoft Outlook — to monitor the “Finance to Process” email folder
•Zoho Books — via OAuth2 API to create bills, vendor credits, and attach documents
•PDF extraction tools — to read invoice data (text-based, AI vision for encrypted/scanned files)
A cron job runs every hour, triggering the agent to scan for new emails, process any invoices found, and report back.
The Workflow
1. Email Scanning
The agent connects to our Outlook inbox and looks specifically at a folder called “Finance to Process.” We just drag invoice emails in there — from any supplier, in any format — and the agent picks them up on the next run.
2. Vendor Matching (No Pre-Configuration Needed)
The agent matches the sender’s email domain to a vendor in a local file. If it’s a new supplier, the agent flags it for review. Over time, We've built up a mapping that covers all our regular vendors — managed service providers, software licensors, telecoms suppliers, hosting providers, vehicle leasing, and overseas SaaS platforms.
The system learns incrementally. No vendor list was pre-loaded — it was built over time as new suppliers appeared.
3. Data Extraction from PDFs
The agent downloads the PDF attachment and extracts: - Invoice number, date, due date - Line items with descriptions, quantities, unit prices - Subtotal, VAT amount, total - Customer reference or PO number
The extraction uses a tiered approach: - Level 1: for searchable PDFs (fast, reliable) - Level 2: PDF layout analysis for complex invoices with tables - Level 3: AI vision ( tool) for encrypted or scanned PDFs that can’t be read as text (like ALD Automotive’s password-protected invoices)
4. Smart Account & Tax Allocation
This is where the real intelligence lives. Instead of hard-coding nominal codes, the agent looks up the vendor’s most recent bill in Zoho Books and clones the account codes and tax rates from there. This means:
•If we've already told Zoho that a managed service provider’s bills go to “Managed Service Purchases” (COGS), every new bill from that vendor follows automatically.
•If a supplier uses standard 20% VAT, the next bill gets standard VAT.
•If a supplier is new, the agent asks rather than guessing.
This “clone from the last bill” approach is the secret sauce. It means the system gets smarter over time without us having to maintain a massive mapping table.
The Subtle Edge-Cases (Where It Gets Interesting)
Reverse Charge VAT — UK Telecoms
Some UK telecoms suppliers issue invoices with a mix of UK service charges (with VAT) and call charges (reverse charge). Under UK VAT rules, call charges for business telecoms fall under the domestic reverse charge mechanism.
The agent splits these into two separate Zoho bills:
1.Main bill — service charges with standard 20% VAT
2.“R” suffix bill — call charges only, with set to “Standard Rate” and no tax_id on line items
Zoho then auto-calculates the 20% reverse charge VAT on the total, which correctly appears in Box 1 and Box 4 of the VAT return with no cash impact.
Overseas Reverse Charge — Non-UK Suppliers
Some overseas suppliers — based in the US, Australia, and elsewhere — charge no UK VAT. For these, the agent creates a single bill with all line items using but no . Zoho calculates the 20% self-accounted VAT automatically.
Unlike the domestic telecom split, there’s no “R” suffix bill — everything goes on one bill because there’s no mix of VAT treatments.
Inclusive Tax — Vehicle Leasing
Vehicle leasing invoices show VAT-inclusive pricing. The agent sets and uses the special “Vehicle Leasing Rate” tax ID (9.0909%), which correctly handles the 50% VAT-reclaimable nature of commercial vehicle leasing.
VAT Rounding Adjustments — The “5p/-5p” Method
Here’s a subtle one. Zoho Books calculates VAT on the total of a bill. Most suppliers calculate VAT per line item and round each line individually. These two methods can produce results that differ by 1p, 2p, or sometimes more.
The agent solves this with a neat trick:
•After creating a bill, it compares Zoho’s calculated subtotal, VAT, and total against the PDF’s figures.
•If Zoho’s VAT is 1p too low, the agent adds two offsetting lines:
–+5p with VAT (adds 1p VAT, 5p subtotal)
–-5p with no VAT (subtracts 5p subtotal, no VAT impact)
•Net result: subtotal unchanged, VAT +1p, total +1p. All three figures now match the PDF exactly.
The scale factor is 5p per 1p of VAT adjustment at 20%. So 2p short = ±10p, 3p short = ±15p. It’s a zero-net-impact adjustment that keeps the books perfectly aligned with the supplier’s invoice.
Dual Attachments — PDF + CSV
One cloud licensing supplier sends both a PDF summary and a CSV with detailed line items. The agent attaches both files to the Zoho bill, so we have the full breakdown available without having to log into the supplier portal.
Skip Rules
Some suppliers are handled manually as expenses rather than bills — for example, a time-tracking tool we use for project billing. The agent skips these automatically — it moves the email to “Processed Mail” and notes it as skipped, without creating any Zoho entry.
The Credit Note Test — Passed Without Training
Recently, we tested the system with something it had never seen before: a credit note.
We received a credit note from one of our managed service providers for £52.80, cancelling a server protection line item from a recent invoice. We then dropped it in the “Finance to Process” folder and waited.
The agent:
1.Identified the existing bill — found the matching bill in Zoho Books (£480.96 total)
2.Created a vendor credit with the correct account code (Managed Service Purchases) and tax rate (Standard 20%)
3.Applied the credit to the original bill — reducing the balance from £480.96 to £428.16
4.Attached the credit note PDF to the vendor credit record
5.Moved the email to “Processed Mail”
6.Updated the state file to mark it as processed
It did all of this without any prior training on credit notes. The agent recognised the negative value, understood it was a credit, matched it to the right invoice by number, and used the Zoho Books vendor credit API correctly.
This was the moment we knew the system was truly robust. Not because it handles the 95% of normal invoices — but because it gracefully handled the edge case it had never been explicitly taught.
What’s Next
The backlog is cleared. All 50+ invoices from recent months have been processed and reconciled. The system now runs hourly, silently processing new invoices as they arrive.
Planned enhancements: - Multi-currency handling for USD invoices from overseas suppliers - Automatic reconciliation against bank feeds when bills are paid - Supplier statement matching to catch missing invoices
The Bottom Line
If you’re a small business owner or MSP drowning in supplier invoices, you don’t need expensive AP automation software. You need an agent that understands your chart of accounts, learns your suppliers, and handles the weird edge-cases that make real-world accounting messy.
OpenClaw + Zoho Books has saved us hours every week. More importantly, it’s eliminated the human errors that creep in when you’re manually entering data at 6pm on a Friday.
