Skip to product information

Invoice OCR & Validation with OpenAI, PostgreSQL & Slack

Invoice OCR & Validation with OpenAI, PostgreSQL & Slack

 (200+Reviews)
Regular price £19.99
Regular price £19.99 Sale price
SAVE Sold out
Instant Digital Download
Unlimited Downloads
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
23 people viewing
High interest right now
9 added today
Fast-moving digital product
Invoice OCR & Validation with OpenAI, PostgreSQL & Slack

Invoice OCR & Validation with OpenAI, PostgreSQL & Slack

Regular price £19.99
Regular price £19.99 Sale price
SAVE Sold out

Automatically extract, validate, and log invoices from PDF—then notify Slack

This n8n workflow receives invoice PDFs via a webhook, uses OpenAI to extract structured invoice data, validates required fields, saves results to PostgreSQL, and posts a clear status update to Slack—with success/error responses returned to the webhook caller.

What this workflow does

  • Receives invoices: Accepts an uploaded PDF through a POST webhook endpoint (use the binary field name file).
  • Extracts and cleans text: Pulls text from the PDF and normalizes whitespace and line breaks for reliable parsing.
  • Parses invoice fields with OpenAI: Sends the cleaned invoice text to OpenAI to extract key fields (e.g., vendor, invoice number, dates, amounts, currency, tax, and category) as JSON using gpt-4o-mini.
  • Validates required data: Checks that essential fields like vendor name and total amount are present.
  • Stores outcomes in PostgreSQL:
    • Valid invoices are written to public.invoices.
    • Validation failures are recorded in failed_invoices.
  • Notifies Slack: Posts a formatted message to the same Slack channel for both successful and failed processing.
  • Returns a webhook response: Sends a JSON success or failed status response after processing completes.

Use cases

  • SaaS operations teams ingest incoming supplier invoices and turn PDFs into structured records automatically.
  • Automation engineers route invoice data into accounting-like systems using validated fields only.
  • Teams that need audit-friendly error handling for unreadable or incomplete invoices.

Technical details

  • Nodes/stack: webhook, OpenAI (gpt-4o-mini), code, if, postgres, slack, sticky note
  • Core logic: PDF text extraction & cleaning → OpenAI JSON parsing → required-field validation → PostgreSQL write → Slack notification → webhook JSON response
View full details