Mask PII in documents for GDPR-safe AI processing with Postgres and Claude
Ready for 3.0What this workflow does
This AI workflow has 24 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects Postgres, Anthropic Chat Model and Ollama Chat Model.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Workflow Configuration (Edit Fields (Set)): sets 4 fields: documentId, confidenceThreshold, vaultTable…
- OCR Extract Text (Extract from File): extracts data from a file (pdf)
- Email Detector (Code): runs custom JavaScript code
- Phone Detector (Code): runs custom JavaScript code
- ID Number Detector (Code): runs custom JavaScript code
- Address Detector AI (AI Agent): runs an AI agent, with model: Ollama Chat Model; output parser: Address Output Parser
- Merge: merges the data from its input branches
- PII Consolidation & Conflict Resolver (Code): runs custom JavaScript code
- Tokenization & Vault Storage (Code): runs custom JavaScript code
- Store Tokens in Vault (Postgres): uses Postgres
…plus 9 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (12)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Extract from File
n8n-nodes-base.extractFromFile - Code
n8n-nodes-base.code - AI Agent
@n8n/n8n-nodes-langchain.agent - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Merge
n8n-nodes-base.merge - Postgres
n8n-nodes-base.postgres - Anthropic Chat Model
@n8n/n8n-nodes-langchain.lmChatAnthropic - If
n8n-nodes-base.if - HTTP Request
n8n-nodes-base.httpRequest - Ollama Chat Model
@n8n/n8n-nodes-langchain.lmChatOllama
From the author
Overview This workflow implements a privacy-preserving AI document processing pipeline that detects, masks, and securely manages Personally Identifiable Information (PII) before any AI processing occurs. Organizations often need to analyze documents such as…