Invoice Processing, Deduplication & Notion Ledger Automation - n8n Workflow

Use this robust n8n workflow to automate invoice processing. It features Slack file triggering, OCR extraction, Claude AI parsing, duplicate checking, and dynamic Notion Ledger updates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Finance and Accounting teams managing a high volume of vendor invoices.

  • Operations specialists needing structured data extraction from images and PDFs.

  • Users looking for advanced examples of robust, multi-step n8n templates integrating AI, OCR, and databases.

  • Businesses requiring approval workflows for new or suspicious transactions.

Overview

Managing vendor invoices manually is time-consuming and prone to duplication errors. This comprehensive n8n workflow solves this by providing an end-to-end automation solution. It utilizes a Slack input to trigger processing, automatically handles files (PDFs and images) via OCR, leverages the Claude AI language model for highly accurate structured data extraction (vendor, amount, dates, line items), and performs sophisticated internal and external duplicate checks against existing Notion databases. Depending on whether the invoice is new, a duplicate, or a payment against an existing invoice, the n8n workflow dynamically creates, updates, or archives records in your Notion Invoice Ledger and Cashflow Ledger, or routes ambiguous cases to a manual Slack review process. This advanced n8n template ensures data integrity and drastically reduces processing time.

How it Works

The entire process is initiated by the n8n trigger when a file is posted to a designated Slack channel.


  1. Ingestion & Format Handling: The Slack n8n trigger captures the file details. A Code n8n node checks the file MIME type (Image or Document/PDF) and routes the binary file download accordingly.

  2. OCR Extraction: The binary file is sent to OCR Space. Separate paths are maintained for images and documents. Error handling nodes (Check parsing Error2/Check parsing Error3) stop the workflow if OCR fails, preventing bad data from entering the system.

  3. AI Parsing (Claude/Anthropic): The raw OCR text is passed to the Basic LLM Chain using the Anthropic Chat Model (Claude 3.5 Haiku) n8n node. This powerful n8n node follows a precise prompt to extract 15+ standardized invoice fields into a robust JSON schema.

  4. Data Cleansing and Deduplication: The Cleans AI Response code node meticulously cleanses and normalizes the AI-generated data, resolving payment arithmetic and clamping values. The Internal Check Duplicate Invoice n8n node then flags entries that are duplicates within the current batch based on canonicalized vendor names and invoice numbers, ensuring only one 'master' copy continues.

  5. External DB Check: The workflow uses a Code n8n node (Create Query for DB) to generate a dynamic Notion API query. It checks the Notion Invoice Ledger for existing matches based on Invoice No + Vendor or a fallback heuristic (Amount + Date window).

  6. Decision Making: The Merge Items Invoice code node compares the extracted data against any Notion matches, determining the nextaction (e.g., createpaid, updatemarkpaid, manual_review).

  7. Execution Paths: The Decide Fate Switch n8n node routes the data to the final Notion operations:

Auto-Processing: Creates new Unpaid/Paid invoices, or updates existing invoices marked as paid. Paid routes also create entries in the Notion Cashflow Ledger.
Archival: Detected duplicates or invoices that caused no change are sent to Notion Archive databases.
* Manual Review: Ambiguous cases (e.g., multiple DB matches, amount mismatch) trigger a Slack message with interactive buttons (Send a message followed by a Wait n8n node) for human intervention. The manual approval resumes the workflow and completes the final Notion update based on the reviewer's choice.

Installation Guide

To deploy this comprehensive n8n workflow and its advanced functionality, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and import it directly into your n8n instance.

  2. Set Up Credentials: This n8n workflow requires several credentials. Configure them using the global or node-specific credential setup:

Slack API: Required for the Slack trigger, downloading binary files, and sending notifications/manual review messages.
Notion API: Required for accessing and modifying the four Notion databases (Invoice Ledger, Cashflow, Source File, and Archives).
OCR Space API: Required for the OCR parsing steps.
Anthropic API: Required for the LLM data extraction, connecting to the Anthropic Chat Model4 n8n node.

  1. Configure Notion Database IDs: Replace the placeholder database IDs in the various Notion n8n node configurations with the actual IDs of your structured Notion databases for Invoices, Cashflow, Source Files, and Archives.

  2. Configure Slack Channels: Update the Slack Trigger and all Slack notification n8n nodes with your desired Channel IDs for expense submission, general notifications, and duplicate alerts.

  3. Activate the n8n Trigger: Ensure the Slack Trigger n8n node is activated in production mode to start listening for incoming files.

Node Details

Slack Trigger: The starting n8n trigger, listening for file uploads or messages containing files in a specific Slack channel, initiating the expense automation.
Code (Format Check, Cleans AI Response, Internal Check Duplicate Invoice, etc.): Multiple custom Code n8n nodes perform critical functions: determining file type, consolidating OCR text, robustly cleaning and normalizing LLM output, running complex financial arithmetic, and executing the multi-stage deduplication logic.
HTTP Request (OCR Space Parse): This n8n node sends the binary invoice file to the OCR Space API to convert image or PDF text into machine-readable format.
Anthropic Chat Model4: A core component of this n8n workflow. It uses the Claude language model for highly accurate, structured JSON extraction from the raw OCR text, enforcing a strict invoice data schema.
If/Switch n8n node: Used extensively (Check Format, Decide Fate for Data, Decide Fate) for sophisticated flow control, routing items based on file type, deduplication role, and database match outcomes.
Notion n8n node: Used for all database interactions (create, update, archive) across four separate databases (Invoice Ledger, Cashflow Ledger, Source Files, and Archive). This n8n node manages relations between the records.


  • Slack n8n node & Wait n8n node: Together, these create the manual approval/review loop, notifying users of complex cases and pausing the n8n workflow execution until a decision is made via a button click.

Related n8n Workflows

Free

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by

Featured*