Skip to main content

Automate invoice processing with Gmail, OCR.space, Slack & Xero

Workflow preview

Workflow preview
100%
Automate invoice processing with Gmail, OCR.space, Slack & Xero preview
Open on n8n.io

Important notice

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

1. Workflow Overview

How It Works 1. Trigger : Watches for new emails in Gmail with PDF/image attachments. 2. OCR : Sends the attachment to OCR.space API (https://ocr.space/OCRAPI) to extract invoice text. 3. Parsing :...

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.code, n8n-nodes-base.googlesheets, n8n-nodes-base.slack, n8n-nodes-base.if, n8n-nodes-base.gmail, n8n-nodes-base.xero, n8n-nodes-base.httprequest

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Automate invoice processing with Gmail, OCR.space, Slack & Xero
Workflow name
Automate invoice processing with Gmail, OCR.space, Slack & Xero

How It Works

  1. Trigger: Watches for new emails in Gmail with PDF/image attachments.
  2. OCR: Sends the attachment to OCR.space API (https://ocr.space/OCRAPI) to extract invoice text.
  3. Parsing: Extracts key fields:
    • Vendor
    • Invoice number
    • Amount
    • Currency
    • Invoice date
    • Due date
    • Description
  4. Validation Logic:
    • Checks if amount is valid
    • Ensures vendor and invoice number are present
    • Flags high-value invoices (e.g., over $10,000)
  5. Routing:
    • If invalid:
    • Sends a Slack message highlighting issues
    • Labels email as Rejected
    • If valid:
      • Logs the invoice into Google Sheets
      • Sends a Slack message to the finance team for approval
      • After approval, creates a draft invoice in Xero
      • Labels the email as Processed in Gmail

Set up steps

• Estimated setup time: 45-60 mins • You’ll need connected credentials for Gmail, Slack, Google Sheets, and Xero • Replace the default API key for OCR.space with your own (in the HTTP Request node) • Update Slack channel IDs and label IDs to match your workspace • Adjust invoice validation rules as needed (e.g. currency, red flag conditions)

All detailed explanations and field mappings are provided in sticky notes within the workflow.

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

Block 2 - Code in JavaScript

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Append or update row in sheet

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 4 - Slack Approval Request

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 5 - Slack Rejection message

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 6 - Check Qualification

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

Block 7 - Parse Invoice Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Format for Slack

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Rejection message

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 10 - Success message

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 11 - Update Rejected Status

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 12 - Update Approved Status

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 13 - Add Processed label

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

Block 14 - Add Rejected label

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

Block 15 - Get many contacts

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

Block 16 - Clean Invoice Payload

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Create invoice

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 18 - Has Valid Attachment?

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

Block 19 - Was Approved?

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

Block 20 - Extract Text

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 21 - Sticky Note

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

Block 22 - Sticky Note1

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

Block 23 - Sticky Note2

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

Block 24 - Sticky Note3

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

3. Summary Table

Workflow Automate invoice processing with Gmail, OCR.space, Slack & Xero
Complexity advanced
Nodes 24
Categories Invoice Processing, AI Summarization
Author Abi Odedeyi
Published 19 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9905/9905.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 with Gmail, OCR.space, Slack & Xero do?

How It Works 1. Trigger : Watches for new emails in Gmail with PDF/image attachments. 2. OCR : Sends the attachment to OCR.space API (https://ocr.space/OCRAPI) to extract invoice text. 3. Parsing :...

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.