← Back to Portfolio

AI Invoice Processor — n8n Automation

Javascript Javascript
Node.js Node.js
n8n n8n
AI AI
Project Overview:
  • Project: AI Invoice Processing Automation
  • Platform: n8n (self-hosted workflow automation)
  • AI Model: OpenAI GPT-4o-mini
  • Objective: Automatically monitor Gmail for incoming invoices, extract structured data from PDF attachments using AI, log everything to a Google Sheets ledger, and alert the finance team when high-value invoices arrive.
Background:
Accounts payable teams spend countless hours on manual invoice data entry — opening email attachments, reading PDF invoices, copying vendor names, amounts, and due dates into spreadsheets. It’s repetitive, error-prone, and scales poorly as a business grows. This automation replaces that entire workflow: it watches your inbox for PDF attachments, extracts all relevant invoice fields using AI, organizes everything into a structured Google Sheets ledger, and flags high-value invoices for immediate attention.
AI Invoice Processor Cover
How It Works:
Gmail Monitoring & PDF Detection:
The workflow automatically polls Gmail for new emails containing PDF attachments. It identifies likely invoices by scanning subject lines, sender domains, and attachment filenames — filtering out marketing materials, reports, and other non-invoice PDFs before processing.
AI-Powered Data Extraction:
Each PDF is converted to text and sent to GPT-4o-mini with a structured extraction prompt. The AI identifies and extracts: vendor/company name, invoice number, issue date, due date, total amount, currency, line items with quantities and unit prices, tax breakdown, and payment terms. The output is returned as structured JSON, ready for direct insertion into any system.
Ledger Logging & Smart Alerts:
  • Google Sheets Ledger: Every extracted invoice is automatically appended to a master spreadsheet with all fields formatted and organized by date.
  • Duplicate Detection: The system checks invoice numbers against existing records to prevent double-entries.
  • High-Value Alerts: Invoices exceeding a configurable threshold (e.g., $5,000) trigger an immediate Slack notification to the finance team with full details.
  • Weekly Summary: An automated digest of all processed invoices, totals by vendor, and upcoming due dates.
AI Invoice Processor Workflow
Key Results:
  • Processing Speed: Each invoice fully extracted and logged in under 15 seconds — versus 5–10 minutes of manual entry.
  • Accuracy: AI extraction matches human accuracy for standard invoice formats, with structured validation for amounts and dates.
  • Zero Missed Invoices: Automated monitoring means no invoice sits unprocessed in an inbox for days.
  • Cost Efficiency: Processes hundreds of invoices per month for less than $2 in API costs.
AI Invoice Processor Dashboard
Tech Stack:
  • Automation: n8n (self-hosted)
  • AI: OpenAI GPT-4o-mini
  • Email: Gmail API
  • PDF Processing: Text extraction pipeline
  • Data Storage: Google Sheets API
  • Notifications: Slack API
Source Code: View on GitHub →