🧾 Automate invoice processing from Gmail with Azure GPT-4.1 and human verification

⚑ 782 views · 🧾 Invoice Processing

Description

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

This n8n workflow automates invoice management by integrating Gmail, PDF analysis, and Azure OpenAI GPT-4.1, with an optional human verification step for accuracy and control. It’s ideal for businesses or individuals who regularly receive invoice emails and want to streamline their accounts payable process with minimal manual effort.

The system continuously monitors Gmail for new messages from specified senders. When it detects an email with a PDF attachment and relevant subject line (e.g., β€œInvoice”), it automatically extracts text from the PDF, analyzes it using Azure OpenAI, and determines if it is a valid invoice. If the AI is uncertain, the workflow sends a manual approval request to a human reviewer. Valid invoices are saved to local storage with a timestamped filename, and a confirmation email is sent upon successful processing.

🎯 Who This Is For

  1. Small to medium businesses
  2. Freelancers or consultants who receive invoices via email
  3. IT or automation teams looking to streamline document workflows
  4. Anyone using n8n with access to Gmail and Azure OpenAI

βœ… Features

βš™οΈ Setup Instructions

1. Prerequisites

2. Gmail OAuth2 Setup

3. Azure OpenAI Setup

4. Customize Workflow Settings

5. Testing the Workflow

πŸ”„ Workflow Steps

Gmail Trigger β†’ Check for PDF Invoice β†’ Extract PDF Text β†’ Analyze with GPT-4.1 β†’ ↳ If Invoice: Save & Notify ↳ If Uncertain: Request Human Review ↳ If Not Invoice: Send Invalid Alert

πŸ”— Nodes Used

Write Binary File, Gmail, Stop and Error, Gmail Trigger, Azure OpenAI Chat Model, Information Extractor

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup