Overview
An n8n workflow pulls the text out of PDF attachments in a shared inbox, sorts each one into invoice, purchase order, quote or statement with a Text Classifier node, and sends anything unclear to a person.
Problem or Objective
- Which agents run multi-step workflows across your apps?
- Which agents sort email, draft replies and clear the backlog for you?
More in Finance and Admin
AI Agents and Models
Tools and Integrations
- Tools
- n8n
- Prerequisites
- An n8n instance, a chat model API key, and access to the shared inbox and the folders where documents are filed.
How It Works
Build the workflow in n8n. Start it from new emails with attachments in the shared inbox where documents arrive; check which trigger n8n offers for your mail provider. For each PDF attachment, use the Extract From File node to get its text. Pass the text to a Text Classifier node with four categories, each with a one-line description: invoice, purchase order, quote and statement. Turn on the Other branch so anything that fits none of them is kept, not dropped. Route each category to its own folder or label, and send the Other branch, plus anything with bank details or personal data, to a review queue a person checks daily. Spot-check a sample of sorted files each week.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up n8n.
- Connect the toolsConnect the tools this workflow relies on: n8n.
- Check the prerequisitesAn n8n instance, a chat model API key, and access to the shared inbox and the folders where documents are filed.
- Gather your detailsCollect what the prompt asks for: Your company, Who sends you statements.
- Run the starter promptPaste the starter prompt below into n8n and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at docs.n8n.io before you rely on it.
Practical Starter Prompt: Describe the document categories
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Classify this document text into exactly one of these categories for [Your company]. invoice: a bill from a supplier asking us to pay, usually with an invoice number and due date. purchase order: an order we or a customer issued, with a PO number. quote: a price offer that is not yet an order. statement: a summary of several transactions over a period from [Who sends you statements]. If none clearly fits, or the text is unreadable, answer Other so a person reviews it. Do not guess.Check the review queue daily and spot-check a sample of sorted files each week before trusting the routing.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. The n8n docs describe a Text Classifier node that sends each item to a model with your categories and descriptions and can output unmatched items on an Other branch, and an Extract From File node that converts PDFs and spreadsheets into data the workflow can use. They do not name a mail provider or document store, so those connections are unverified, and nothing reports accuracy.
Limitations and Considerations
By default the Text Classifier discards items that match no category, so turn on the Other branch. Scanned PDFs that are only images may give no text to extract, so check whether you need a text recognition step. Invoices and statements carry bank and personal details; check where your model provider processes them. Results depend on how clearly you describe each category. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Related Videos
About n8n-io/n8n
Give Your Agent Tools (n8n Agents Course 5/7) (opens in a new tab)
Walkthrough of n8n by n8n: it is on the project’s own channel.
Watch on YouTube (opens in a new tab)About n8n-io/n8n
n8n AI Nodes: Connect OpenAI, Claude, and Local Models (opens in a new tab)
Walkthrough of n8n by AI Daily Lab: its description links the GitHub repository.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Text Classifier | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 27 Nov 2026, 04:17 UTC
What this source supports
- Use the Text Classifier node to classify (categorize) incoming data; using the categories provided in the parameters, each item is passed to the model to determine its category.
- Categories have a name and a description; use the description to tell the model what the category means.
- Discard Item is the default when the node does not detect any of the categories; Output on Extra, 'Other' Branch creates a separate output branch called Other.
- Extract From File | Nodes | n8n Docs (opens in a new tab)
Project documentation · docs.n8n.io · Undated · Source checked 27 Nov 2026, 04:17 UTC
What this source supports
- The Extract From File node extracts data from a binary format file and converts it to JSON, which can then be easily manipulated by the rest of your workflow.
- Extract From PDF: Extract fields from Portable Document Format files.

