Skip to main content

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

Workflow preview

Workflow preview
100%
Automate invoice processing from Gmail with Azure GPT-4.1 and human verification preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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 Op...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, n8n-nodes-base.if, n8n-nodes-base.writebinaryfile, n8n-nodes-base.merge, @n8n/n8n-nodes-langchain.informationextractor, n8n-nodes-base.gmail, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.lmchatazureopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Sachin Shrestha.

Original n8n.io source

1.1 Workflow description

Title
Automate invoice processing from Gmail with Azure GPT-4.1 and human verification
Workflow name
Automate invoice processing from Gmail with Azure GPT-4.1 and human verification

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

  • Gmail Monitoring – Automatically checks for new emails from trusted senders
  • AI-Powered Invoice Detection – Uses Azure GPT-4.1 to intelligently verify PDF contents
  • PDF Text Extraction – Extracts readable text for analysis
  • Human-in-the-Loop Verification – Requests approval when AI confidence is low
  • Secure File Storage – Saves invoices locally with structured filenames
  • Email Notifications – Sends confirmations or manual review alerts

⚙️ Setup Instructions

1. Prerequisites

  • An active n8n instance (self-hosted or cloud)
  • A Gmail account with OAuth2 credentials
  • An Azure OpenAI account with access to the GPT-4.1 model
  • A local directory for saving invoices (e.g., C:/Test/Invoices/)

2. Gmail OAuth2 Setup

  • In n8n, create Gmail OAuth2 credentials.
  • Configure it with Gmail API access (read emails and attachments).
  • Update the Gmail Trigger node to filter by sender email (e.g., [email protected]).

3. Azure OpenAI Setup

  • Create Azure OpenAI API credentials in n8n.
  • Ensure your endpoint is correctly set and GPT-4.1 access is enabled.
  • Link the credentials in the AI Analysis node.

4. Customize Workflow Settings

  • Sender Email – Update in Gmail Trigger
  • Notification Email – Update in Send Notification node
  • Save Directory – Change in Save Invoice node

5. Testing the Workflow

  • Send a test email from the configured sender with a PDF invoice.
  • Wait for the workflow to trigger and check for:
  • File saved in the directory
  • Confirmation email received
  • Manual review request (if needed)

🔄 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

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1

Block 2 - IF: AI Says Yes

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 3 - Save PDF Locally

Type / Role
n8n-nodes-base.writeBinaryFile - writeBinaryFile
Config choices
Version 1

Block 4 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 5 - Information Extractor

Type / Role
@n8n/n8n-nodes-langchain.informationExtractor - informationExtractor
Config choices
Version 1.2

Block 6 - Is this PDF?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 7 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 8 - Invoice Saved Message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 9 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Azure OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatAzureOpenAi - lmChatAzureOpenAi
Config choices
Version 1

Block 14 - Manual Verification

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 15 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Error Handler

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

3. Summary Table

Workflow Automate invoice processing from Gmail with Azure GPT-4.1 and human verification
Complexity advanced
Nodes 17
Categories Invoice Processing, AI Summarization
Author Sachin Shrestha
Published 16 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6062/6062.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate invoice processing from Gmail with Azure GPT-4.1 and human verification do?

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 Op...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.