AI Invoice Extractor
A webhook-driven AI pipeline that turns PDF invoices into structured, validated records and logs clean results to Google Sheets.
Overview
Day 1 focuses on building a reliable extraction pipeline rather than simply asking an AI model to read a document. The important part is the validation layer: the workflow checks required fields, line-item math, subtotal reconciliation, and subtotal + tax = total before writing data to the spreadsheet.
The Problem
Invoice processing is repetitive and easy to get wrong. Manually copying vendor details, dates, totals and line items into a spreadsheet creates unnecessary work and makes arithmetic or transcription errors harder to catch.
The Solution
The workflow accepts a PDF through a webhook, extracts its text, uses an OpenRouter-backed LLM to produce structured invoice data, then validates required fields and invoice arithmetic before routing the result. Valid records are appended to Google Sheets; inconsistent or incomplete invoices are returned for manual review instead of being silently accepted.
How the Workflow Works
- 1Receive an invoice PDF through a POST webhook.
- 2Extract text from the uploaded PDF.
- 3Send the invoice text to the LLM with a strict JSON schema and no-guessing rules.
- 4Normalize values and validate required fields and invoice arithmetic.
- 5Route valid data to Google Sheets or return a manual-review response with the validation reason.
Workflow Architecture
Key Features
Tech Stack
Scope & Limitations
- Designed for text-based PDF invoices.
- Scanned or photographed invoices need a vision-capable extraction step.
- Credentials and production webhook configuration are intentionally excluded from the public JSON.