Automated Invoice Processing And Approval With n8n And GPT 4o
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
Importing this blueprint? Follow the n8n guide — credentials, test runs, and common pitfalls.
Open import docs →Download Integration Assets
Import this editorially reviewed blueprint directly into your n8n dashboard.
Connected Apps
Interactive Workflow Canvas
Drag nodes vertically to re-order execution sequence. Edit or add steps to customize your blueprint.
Execution Steps
-
Detect Invoice Email Attachment in Gmail
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n Gmail trigger node -
Save PDF to Google Drive
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n Google Drive node -
Extract Invoice Text via PDF Parsing
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n HTTP Request node (PDF.co API) + Code node -
GPT-4o Extracts Vendor, Amount, Due Date, and Line Items
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n OpenAI node -
Validate Against Vendor Database
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n Google Sheets node + Code node -
Create QuickBooks Draft Bill
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n HTTP Request node (QuickBooks API) -
Slack Approval Request for Amounts Over $1,000
Extract invoice data from email PDFs with GPT-4o, create QuickBooks draft bills, and route approvals via Slack.
n8n Slack node
Prompt Customizer Sandbox
Variables
You are an expert accounts payable specialist. Extract structured data from the following invoice text. The text has been extracted from a PDF via OCR and may contain formatting artifacts.
Invoice text:
[INVOICE_TEXT]
Extract and return the following as valid JSON:
{
"vendor_name": "...",
"vendor_address": "..." or null,
"invoice_number": "...",
"invoice_date": "YYYY-MM-DD" or null,
"due_date": "YYYY-MM-DD" or null,
"payment_terms": "..." or null,
"currency": "USD",
"subtotal": number or null,
"tax_amount": number or null,
"total_amount": number,
"line_items": [
{
"description": "...",
"quantity": number or null,
"unit_price": number or null,
"amount": number
}
],
"po_number": "..." or null,
"bank_details": {
"account_name": "..." or null,
"account_number": "..." or null,
"routing_number": "..." or null,
"swift_bic": "..." or null
},
"extraction_confidence": "high" | "medium" | "low",
"extraction_notes": "..." or null
}
Rules:
- Return numeric values as numbers, not strings (e.g., 1250.00 not "$1,250.00").
- If a field cannot be found with confidence, return null rather than guessing.
- Set extraction_confidence to "low" if the PDF text quality is poor, dates are ambiguous, or total_amount is unclear.
- Set extraction_notes to a brief explanation of any issues or ambiguities encountered.
- Return valid JSON only. No additional text outside the JSON object.
Finance and operations teams at small and mid-size companies spend disproportionate time on invoice processing — a task that feels like it should have been automated years ago. The problem isn’t receiving invoices; it’s the downstream work: opening the PDF, reading the fields, re-typing vendor name, amount, due date, and line items into QuickBooks, getting approval from a manager for anything over a threshold, and filing the document somewhere findable. A moderately busy company processing 20–30 invoices per week can lose 5–8 hours to this mechanical work, and errors are common when numbers are transcribed by hand.
This n8n workflow handles the full invoice-to-QuickBooks pipeline with human oversight preserved exactly where it matters. GPT-4o extracts structured data from PDF invoices with high accuracy across standard vendor invoice formats — it handles varied layouts, non-standard date formats, and partial OCR artifacts far better than template-based extraction tools. Validation against your approved vendor list catches new or unexpected vendors before they reach the ledger. The $1,000 approval threshold (fully configurable) ensures finance has a final review gate on material spend while letting routine small invoices flow through automatically.
The Intermediate difficulty rating reflects the QuickBooks API OAuth setup and the PDF.co integration — these are the two steps that require more careful configuration. Budget 45–60 minutes for a thorough first setup and testing with 3–5 real invoices.
Prerequisites
- An n8n instance with a public HTTPS URL (required for QuickBooks OAuth callback; n8n Cloud works out of the box)
- A Gmail account (or Google Workspace) with a Gmail filter rule that labels incoming invoices with a custom label (e.g., “invoices”)
- An OpenAI API key with GPT-4o access
- A PDF.co account for PDF text extraction (free tier: 1,000 pages/month; paid plans start at $29/month for 10,000 pages)
- A Google Sheet named “Approved Vendors” with columns: Vendor Name, QuickBooks Vendor ID, Default Account Code, Approval Threshold Override (optional)
- A QuickBooks Online account with API access — requires creating an app at developer.intuit.com and completing OAuth 2.0 setup (the most complex prerequisite; plan 15–20 minutes for this alone)
- A Slack workspace with a
#finance-approvalschannel and an approved Slack app/bot for posting messages - A Google Drive folder structure:
Invoices/2026/June/etc. (the workflow auto-creates monthly subfolders)
Setup Guide
- Import the blueprint — Import the n8n JSON workflow. You’ll see 12 nodes arranged across the main success path and two error/review branches.
- Set up Gmail trigger — Authenticate the Gmail node with your invoices email account. Set the label filter to your custom “invoices” label. Set poll frequency to every 15 minutes (adjust to 5 minutes if invoice processing speed is critical).
- Configure Google Drive — Authenticate the Drive node. The folder path uses a Code node that generates the
Invoices/[YEAR]/[MONTH]structure dynamically from the current date. No manual folder creation needed. - Set up PDF.co — Create a PDF.co account and generate an API key. In the HTTP Request node “Extract PDF Text”, replace
YOUR_PDFCO_API_KEYin the request header. The endpoint used ishttps://api.pdf.co/v1/pdf/convert/to/text. - Configure OpenAI — Add your OpenAI API key to the OpenAI node. Set model to
gpt-4o, temperature to0.1(very low for consistent structured extraction), max tokens to2000. - Set up the Vendor database — Populate your “Approved Vendors” Google Sheet with at least your top 10–15 regular vendors. The fuzzy matching Code node uses a similarity threshold of 85% — vendors with names that are 85%+ similar to an approved vendor are matched automatically. Adjust the threshold in the Code node if you get false positives.
- Complete QuickBooks OAuth — This is the most involved step. In the QuickBooks HTTP Request node, open the credential settings and follow n8n’s QuickBooks OAuth flow. You’ll need your app’s Client ID, Client Secret, and to add your n8n callback URL to the QuickBooks app’s redirect URIs in the Intuit developer portal. Use the QuickBooks sandbox first for testing.
- Configure Slack — Add your Slack bot token. Update the
#finance-approvalschannel name. The message template uses Slack Block Kit for rich formatting (pre-built in the blueprint). - Set the approval threshold — In the IF node “Check Amount > $1000”, change
1000to your preferred approval threshold. Teams with different thresholds by vendor can extend the vendor database with a “Threshold Override” column. - Test with 5 real invoices — Run the workflow manually on test invoices of varying formats (different vendors, different layouts). Check each QuickBooks draft bill for accuracy. Expect 90-95% field accuracy on clean PDFs; scanned/handwritten invoices will have lower accuracy.
Who This Is NOT For
- Companies using accounting software other than QuickBooks Online — Xero, FreshBooks, Sage, or NetSuite users need different API integration steps (the extraction and Drive filing steps remain reusable)
- Businesses receiving invoices in formats other than PDF email attachments (EDI, web portal submissions, paper mail scanning) — those require different ingestion trigger nodes
- Teams processing invoices in languages other than English — the extraction prompt and vendor matching are English-optimized; add language detection and translated prompts for multilingual AP operations
- Finance teams at companies with complex PO-matching requirements, multi-entity accounting structures, or audit trails requiring immutable document management — those needs exceed what this blueprint addresses and typically require dedicated AP automation software like Tipalti or Bill.com
Did this blueprint work for you?
AI integrations change fast. Help keep recipes accurate.
Related Blueprints
More n8n Blueprints
Recommended for Support Teams
- Noop Slack Send Webhook Integrate Sticky Note and LangChain and OpenAI and If and Slack and Webhook automatically using n8n.
- Wait Webhook Send Webhook Integrate Http Request and Code and Set and Merge and If and Wait and Webhook and Item Lists and Slack and Gmail and Filter and Sticky Note and Form Trigger...