This workflow corresponds to n8n.io template #17207 — we link there as the canonical source.
This workflow follows the Gmail → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Compliant AI Document Analysis with Claude \u2014 No Database Required (PromptLock Guard)",
"nodes": [
{
"id": "t4-sticky-overview",
"name": "Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1632,
-48
],
"parameters": {
"width": 480,
"height": 896,
"content": "## Compliant AI Document Analysis with Claude \u2014 No Database Required (PromptLock Guard)\n\n### How it works\n\nA document arrives via webhook as a PDF upload or a JSON body with a text field. PromptLock Guard screens the text for HIPAA, GDPR and PCI data \u2014 and for prompt injection \u2014 before it reaches the model. Clean or redacted text goes to Claude for a structured summary; flagged documents trigger a review email; blocked documents return a fail-closed refusal. Every document is recorded as one row in Google Sheets, so no database is required.\n\n### Setup steps\n\n- Install the n8n-nodes-promptlock-guard community node and add your PromptLock API key (free at promptlock.io).\n- Add Anthropic credentials to the Claude node and confirm the model and request headers.\n- Add Gmail credentials and set the recipient in the human-review email step.\n- Add Google Sheets credentials and point the audit node at a spreadsheet with a DocAuditLog tab.\n- Send a PDF file, or a JSON { \"text\": \"...\" } body, to the webhook URL.\n\n### Customization\n\nChoose which frameworks to screen (HIPAA, GDPR, PCI) and the Action on High Risk (flag, redact, block, or score) on the Guard node. Edit the Claude prompt, change the review-email recipient, or adjust the audit columns (timestamp, action, risk score, compliance status)."
},
"typeVersion": 1
},
{
"id": "t4-sticky-s1",
"name": "Note s1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1072,
32
],
"parameters": {
"color": 7,
"width": 640,
"height": 592,
"content": "## Receive and prepare\n\nAccepts a webhook request containing either a PDF upload or a JSON text body, and normalises it into a single text field for screening."
},
"typeVersion": 1
},
{
"id": "t4-sticky-s2",
"name": "Note s2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
96
],
"parameters": {
"color": 7,
"width": 240,
"height": 448,
"content": "## Compliance screening\n\nRuns the document text through PromptLock Guard, which detects regulated data and prompt injection and routes each document by verdict (allow, flag, redact, block)."
},
"typeVersion": 1
},
{
"id": "t4-sticky-s3",
"name": "Note s3",
"type": "n8n-nodes-base.stickyNote",
"position": [
32,
-48
],
"parameters": {
"color": 7,
"width": 432,
"height": 320,
"content": "## Analyse and respond\n\nSends allowed or redacted text to Claude for a structured summary and returns it in the webhook response."
},
"typeVersion": 1
},
{
"id": "t4-sticky-s4",
"name": "Note s4",
"type": "n8n-nodes-base.stickyNote",
"position": [
144,
304
],
"parameters": {
"color": 7,
"width": 240,
"height": 640,
"content": "## Handle risky documents\n\nEmails a human-review alert for flagged documents, or returns a fail-closed refusal for blocked documents and screening errors."
},
"typeVersion": 1
},
{
"id": "t4-sticky-s5",
"name": "Note s5",
"type": "n8n-nodes-base.stickyNote",
"position": [
560,
176
],
"parameters": {
"color": 7,
"width": 448,
"height": 336,
"content": "## Audit trail\n\nBuilds one row per document \u2014 timestamp, action taken, risk score, compliance status \u2014 and appends it to Google Sheets."
},
"typeVersion": 1
},
{
"id": "a4a9a6ae-cd59-4deb-bf94-d7ed9ebe11b7",
"name": "When Document Received",
"type": "n8n-nodes-base.webhook",
"position": [
-1024,
320
],
"parameters": {
"path": "analyze-document",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "a6431c2e-31c9-4246-bc83-32178138f9bb",
"name": "Check for Binary File",
"type": "n8n-nodes-base.if",
"position": [
-800,
320
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "c1",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ Object.keys($binary || {}).length > 0 }}",
"rightValue": true
}
]
}
},
"typeVersion": 2
},
{
"id": "b70073cd-7581-460f-bb91-a467ad46db90",
"name": "Extract PDF Text",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-576,
192
],
"parameters": {
"options": {},
"operation": "pdf"
},
"typeVersion": 1
},
{
"id": "fdc3ec4d-f293-4cf2-a934-2e25e551de18",
"name": "Set Text Field from JSON",
"type": "n8n-nodes-base.set",
"position": [
-576,
464
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a1",
"name": "text",
"type": "string",
"value": "={{ $json.body.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "786d36e5-7909-49f5-828b-c44473f8a939",
"name": "PromptLock Compliance Guard",
"type": "n8n-nodes-promptlock-guard.promptLockGuard",
"position": [
-288,
320
],
"parameters": {
"additionalSettings": {
"onError": "block",
"actionOnHighRisk": "flag"
}
},
"credentials": {
"promptLockApiKey": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "234400b4-571b-4c9a-98d9-80e592a6ac12",
"name": "Post to Claude API",
"type": "n8n-nodes-base.httpRequest",
"position": [
80,
112
],
"parameters": {
"url": "https://api.anthropic.com/v1/messages",
"method": "POST",
"options": {},
"jsonBody": "={{ JSON.stringify({ model: 'claude-sonnet-4-6', max_tokens: 1500, messages: [{ role: 'user', content: 'Analyze this compliance-screened document. Respond with a raw JSON object only \u2014 no markdown fences, no commentary \u2014 with keys: summary (3 sentences), document_type, key_dates (array), key_terms (array), action_items (array). Document text: ' + ($json.cleanText || $json.text).slice(0, 50000) }] }) }}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "anthropic-version",
"value": "2023-06-01"
}
]
},
"nodeCredentialType": "anthropicApi"
},
"credentials": {
"anthropicApi": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "104efba6-a171-4d97-9ca7-42acdcd92c65",
"name": "Respond with Analysis",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
320,
112
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ status: 'analyzed', compliance: $('PromptLock Compliance Guard').item.json.promptLock, analysis: JSON.parse(($json.content[0].text || '{}').replace(/```json|```/g, '').trim()) }) }}"
},
"typeVersion": 1.1
},
{
"id": "46dcb226-514c-4edf-b395-ae082633d2c2",
"name": "Email for Human Review",
"type": "n8n-nodes-base.gmail",
"position": [
192,
528
],
"parameters": {
"sendTo": "you@example.com",
"message": "=A document was flagged before AI analysis.\n\nRisk score: {{ $json.promptLock.risk_score }}\n\nFindings (values withheld \u2014 see the audit log entry):\n{{ ($json.promptLock.violations || []).map(v => '\u2022 ' + v.category + ' \u2192 ' + (v.placeholder || v.type) + ' (' + Math.round((v.confidence || 0) * 100) + '% confidence)').join('\\n') }}\n\nCompliance status: {{ JSON.stringify($json.promptLock.compliance_status) }}\n\nReview the document manually before processing.",
"options": {},
"subject": "Document flagged for compliance review"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "ac949ca0-5952-4ba7-b5aa-4def40437a1d",
"name": "Send 403 Response",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
192,
784
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "={{ JSON.stringify($json.promptLock && $json.promptLock.error ? { status: 'unverified', reason: 'Compliance screening was unavailable, so the document was not sent to the AI model (failing closed). Retry later or review manually.', compliance: $json.promptLock } : { status: 'blocked', reason: 'Document contains high-risk regulated data and was not sent to the AI model.', compliance: $json.promptLock }) }}"
},
"typeVersion": 1.1
},
{
"id": "a39c91ee-5204-41be-870a-5d2723f8a208",
"name": "Append to Audit Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
864,
352
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "name",
"value": "DocAuditLog"
},
"documentId": {
"__rl": true,
"mode": "url",
"value": "https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit",
"__regex": "https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.5
},
{
"id": "e2a5e6eb-8180-46b4-828d-aefb9861bcee",
"name": "Build Audit Log Entry",
"type": "n8n-nodes-base.set",
"position": [
608,
352
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "852407dc-a36d-44dd-8069-b8d6087cae65",
"name": "timestamp",
"type": "string",
"value": "={{ $now.toISO() }}"
},
{
"id": "bd5ad623-9a78-4a5f-b208-46655f09d3c5",
"name": "action_taken",
"type": "string",
"value": "={{ $('PromptLock Compliance Guard').item.json.promptLock ? ($('PromptLock Compliance Guard').item.json.promptLock.action_taken || 'error') : 'allow' }}"
},
{
"id": "c876d66f-7c5c-4d50-80a6-a326b7319578",
"name": "risk_score",
"type": "string",
"value": "={{ $('PromptLock Compliance Guard').item.json.promptLock ? ($('PromptLock Compliance Guard').item.json.promptLock.risk_score || 0) : 0 }}"
},
{
"id": "93fa6249-0212-4859-89d4-1fda357c8e7f",
"name": "compliance_status",
"type": "string",
"value": "={{ $('PromptLock Compliance Guard').item.json.promptLock ? JSON.stringify($('PromptLock Compliance Guard').item.json.promptLock.compliance_status || $('PromptLock Compliance Guard').item.json.promptLock.error) : 'clean' }}"
}
]
}
},
"typeVersion": 3.4
}
],
"settings": {
"executionOrder": "v1"
},
"connections": {
"Extract PDF Text": {
"main": [
[
{
"node": "PromptLock Compliance Guard",
"type": "main",
"index": 0
}
]
]
},
"Send 403 Response": {
"main": [
[
{
"node": "Build Audit Log Entry",
"type": "main",
"index": 0
}
]
]
},
"Post to Claude API": {
"main": [
[
{
"node": "Respond with Analysis",
"type": "main",
"index": 0
}
]
]
},
"Build Audit Log Entry": {
"main": [
[
{
"node": "Append to Audit Sheet",
"type": "main",
"index": 0
}
]
]
},
"Check for Binary File": {
"main": [
[
{
"node": "Extract PDF Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Text Field from JSON",
"type": "main",
"index": 0
}
]
]
},
"Respond with Analysis": {
"main": [
[
{
"node": "Build Audit Log Entry",
"type": "main",
"index": 0
}
]
]
},
"Email for Human Review": {
"main": [
[
{
"node": "Build Audit Log Entry",
"type": "main",
"index": 0
}
]
]
},
"When Document Received": {
"main": [
[
{
"node": "Check for Binary File",
"type": "main",
"index": 0
}
]
]
},
"Set Text Field from JSON": {
"main": [
[
{
"node": "PromptLock Compliance Guard",
"type": "main",
"index": 0
}
]
]
},
"PromptLock Compliance Guard": {
"main": [
[
{
"node": "Post to Claude API",
"type": "main",
"index": 0
}
],
[
{
"node": "Email for Human Review",
"type": "main",
"index": 0
}
],
[
{
"node": "Post to Claude API",
"type": "main",
"index": 0
}
],
[
{
"node": "Send 403 Response",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
anthropicApigmailOAuth2googleSheetsOAuth2ApipromptLockApiKey
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Screen contracts, intake forms, and reports for HIPAA, GDPR, and PCI data — plus always-on prompt-injection detection — before Claude summarizes them. Clean documents pass through, risky ones get flagged for review or blocked, and every document gets an audit row in a Google…
Source: https://n8n.io/workflows/17207/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Automate WhatsApp communication for recruitment agencies with an interactive, structured customer experience. This workflow handles pricing inquiries, request submissions, tracking, complaints, and hu
This workflow automates HR onboarding by capturing new hires via a webhook, saving them to Google Sheets, emailing a Slack invite via Gmail, and notifying managers in Slack, then listening for Slack t
Advanced AI Powered Document Parsing & Text Extraction with Llama Parse. Uses gmail, gmailTrigger, httpRequest, googleSheets. Webhook trigger; 54 nodes.
This template turns Podium's conversation inbox into a full sales CRM with a custom funnel, AI message classification, automated drip follow-ups, daily admin reports, and a live Kanban dashboard. Six
Ticketing Backend automates registration, QR-ticket generation, email delivery, and check-in validation using Google Sheets, Gmail, and a webhook scanner — reducing manual ticket prep from ~3 hours to