Skip to product information

n8n Workflow: Classify & File Inbound Docs with OpenAI + Gmail

n8n Workflow: Classify & File Inbound Docs with OpenAI + Gmail

 (200+Reviews)
Regular price £74.99
Regular price £74.99 Sale price
SAVE Sold out
Instant Digital Download
Unlimited Downloads
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
23 people viewing
High interest right now
9 added today
Fast-moving digital product
n8n Workflow: Classify & File Inbound Docs with OpenAI + Gmail

n8n Workflow: Classify & File Inbound Docs with OpenAI + Gmail

Regular price £74.99
Regular price £74.99 Sale price
SAVE Sold out

Automatically classify and file inbound documents with OpenAI + Gmail—only when you need a human.

This n8n workflow receives documents via a token-protected webhook, checks OCR and file metadata quality, then uses OpenAI to classify and extract key fields. Every outcome is stored in an n8n Data Table, high-confidence results are filed logically, and Gmail alerts are sent when OCR or AI results require human review.

What this workflow does

  • Secure intake: Accepts a POST request to an n8n webhook and verifies it using a shared intake token.
  • Normalize + key documents: Standardizes the payload (filename, MIME type, IDs, OCR text), generates a deterministic document key, redacts PII for the model, and uses a temporary in-memory claim to reduce concurrent reprocessing.
  • Duplicate protection: Checks the n8n Data Table for an existing row with the same document key scope and immediately returns a “duplicate” response when already processed.
  • Dead-letter invalid inputs: If the item is permanently invalid (e.g., unsupported MIME type or malformed identifiers), it records a dead letter in the Data Table and responds with the dead-letter reason.
  • OpenAI extraction + validation: For acceptable OCR quality, sends a bounded, redacted excerpt to OpenAI to extract metadata (type, party, date, amount, currency). The workflow validates returned JSON against strict rules and confidence thresholds.
  • File vs. review: Fully validated, high-confidence results are recorded as Filed with a logical archive path; other cases become Needs Review and trigger the appropriate Gmail alert before the workflow responds.
  • Scheduled review processing: Runs hourly to find “Needs Review” rows where no alerts have been sent (per the workflow logic).

Use cases

  • Inbox-to-archive automation for customer documents (forms, statements, other inbound files) using OCR + AI classification.
  • Invoice- or record-like processing where only confident extracts are filed automatically.
  • Operational support queues: notify staff via Gmail when OCR quality or AI confidence is insufficient.

Technical details

  • Nodes/stack: webhook, if, code, data table, gmail, sticky note.
  • Core mechanisms: deterministic document keys, PII redaction for OpenAI, strict JSON validation, confidence thresholds, duplicate/dead-letter handling, and Gmail alerts for “Needs Review”.
View full details