Classify and file email PDF documents with Gmail, pdfRest, Drive and Claude
UnknownWhat this workflow does
This AI workflow has 22 nodes and runs on Gmail events. Along the way it connects Gmail, Google Drive, Google Sheets and Slack and 2 more.
How it runs
Trigger: On Gmail events.
- Set Folder and Index IDs (Edit Fields (Set)): sets 7 fields: invoiceFolderId, contractFolderId, correspondenceFolderId…
- Extract Each Attachment (Code): runs custom JavaScript code
- Check PDF Format (If): checks a condition and branches into true / false
- Fetch PDF Metadata (Pdf Rest): pdf info
- Merge: merges the data from its input branches
- Check OCR Requirement (If): checks a condition and branches into true / false
- Apply OCR to PDF (Pdf Rest): ocr
- Set OCR Status Skipped (Edit Fields (Set)): sets 1 field: ocrApplied
- Set OCR Status Applied (Edit Fields (Set)): sets 1 field: ocrApplied
- Convert PDF to Markdown (Pdf Rest): convert markdown
…plus 10 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
We can't fully verify this one: it relies on 1 community package, and n8n 3.0 turns unverified community packages off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
- Check that @pdfrest/n8n-nodes-pdfrest is verified or supports 3.0 (used in Fetch PDF Metadata, Apply OCR to PDF, Convert PDF to Markdown).
- Also check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll).
Nodes used (12)
- Edit Fields (Set)
n8n-nodes-base.set - Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Pdf Rest
@pdfrest/n8n-nodes-pdfrest.pdfRest - Merge
n8n-nodes-base.merge - Information Extractor
@n8n/n8n-nodes-langchain.informationExtractor - Switch
n8n-nodes-base.switch - Google Drive
n8n-nodes-base.googleDrive - Google Sheets
n8n-nodes-base.googleSheets - Slack
n8n-nodes-base.slack - Anthropic Chat Model
@n8n/n8n-nodes-langchain.lmChatAnthropic
From the author
Quick overview This workflow monitors Gmail for emails with PDF attachments, OCRs scanned documents with pdfRest when needed, converts PDFs to Markdown, uses Anthropic Claude via n8n's Information Extractor to classify and extract key fields, then files each…