This workflow corresponds to n8n.io template #12659 — we link there as the canonical source.
This workflow follows the Google Drive → Slack 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "00f55833-40d4-4390-8cc0-d27c6700ceb5",
"name": "Sticky_Approval",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
432
],
"parameters": {
"color": 7,
"width": 420,
"height": 358,
"content": "## \ud83d\udee1\ufe0f PHASE 1: Intake & Approval Gating\nTriggers from Salesforce. Fetches ERP/Legal data and determines the approval depth (up to 6 levels). Pauses for manual approval via Webhook Wait nodes before proceeding to document assembly."
},
"typeVersion": 1
},
{
"id": "4e584a2e-ae69-42fc-811d-b2c851fcdd3d",
"name": "Sticky_Assembly",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
416
],
"parameters": {
"color": 7,
"width": 496,
"height": 374,
"content": "## \ud83c\udfd7\ufe0f PHASE 2: Dynamic Assembly & Compression\nCalculates 'Complexity Score' to set initial compression. Injects live pricing, inventory, and charts into the HTML. If the final PDF exceeds provider limits (25MB), a secondary re-compression cycle is triggered."
},
"typeVersion": 1
},
{
"id": "185fe3bb-a5e5-455d-9ca6-e00cf3f92878",
"name": "Sticky_Audit",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
448
],
"parameters": {
"color": 7,
"width": 460,
"height": 326,
"content": "## \ud83d\ude80 PHASE 3: Delivery & Audit Archival\nDelivers via Gmail, SMS, or DocuSign. Monitors for bounces with SendGrid fallback. Finally, generates a 'Compliance Audit PDF' and logs all performance metrics to Postgres and Sheets."
},
"typeVersion": 1
},
{
"id": "ad68b94c-f796-4218-9556-08f1d4e696c8",
"name": "Code: Approval Router",
"type": "n8n-nodes-base.code",
"position": [
80,
624
],
"parameters": {
"jsCode": "// Code Node #1: Calculate Value Tier & Approval Chain\nconst item = $input.first().json;\nconst value = item.contractValue;\n\nif (value > 500000) {\n item.approvalLevels = 6;\n item.boardNotify = true;\n} else if (value > 50000) {\n item.approvalLevels = 4;\n item.boardNotify = false;\n} else {\n item.approvalLevels = 2;\n item.boardNotify = false;\n}\n\nreturn { json: item };"
},
"typeVersion": 2
},
{
"id": "52483753-4c2b-4b22-9ce4-1035a5f6cbaa",
"name": "Code: Complexity Engine",
"type": "n8n-nodes-base.code",
"position": [
416,
624
],
"parameters": {
"jsCode": "// Code Node #3: Complexity & Compression Prediction\nconst item = $input.first().json;\nconst pages = item.pageEstimate || 10;\nconst domain = item.clientEmail.split('@')[1];\n\n// Decision Matrix for Compression\nif (pages > 30) {\n item.compressionRatio = 0.65;\n item.deliveryMethod = 'drive_link';\n} else if (domain === 'gmail.com') {\n item.compressionRatio = 0.85;\n item.limit = 25;\n} else {\n item.compressionRatio = 0.90;\n item.limit = 20;\n}\n\nreturn { json: item };"
},
"typeVersion": 2
},
{
"id": "73533cce-f38e-4bf9-aa10-51a186203447",
"name": "Code: Size Validator",
"type": "n8n-nodes-base.code",
"position": [
752,
624
],
"parameters": {
"jsCode": "// Code Node #4: Size Validation\nconst binary = $input.first().binary.data;\nconst limit = $input.first().json.limit || 25;\nconst sizeMB = binary.fileSize / 1024 / 1024;\n\nreturn { \n json: { \n sizeExceeded: sizeMB > limit,\n finalSize: sizeMB.toFixed(2) + 'MB'\n }\n};"
},
"typeVersion": 2
},
{
"id": "612bd288-4b18-4986-a38b-9badcf3c48d3",
"name": "Code: Audit Metadata",
"type": "n8n-nodes-base.code",
"position": [
960,
624
],
"parameters": {
"jsCode": "// Code Node #9: Audit Trail Generator\nconst item = $input.first().json;\nitem.auditLog = `\n - Approved by: ${item.approvers.join(', ')}\n - Generated: ${new Date().toISOString()}\n - Final Size: ${item.finalSize}\n - Deliver Proof: ${item.deliveryTimestamp}\n`;\nreturn { json: item };"
},
"typeVersion": 2
},
{
"id": "2e3126a9-06bc-49fb-b8cc-a886e2a2891e",
"name": "Compress PDF",
"type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
"position": [
576,
624
],
"parameters": {
"resource": "pdfManipulation",
"operation": "compressPdf"
},
"credentials": {
"htmlcsstopdfApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "6fda11aa-7544-49cd-af2a-8564242e7e26",
"name": "Sticky_Closure",
"type": "n8n-nodes-base.stickyNote",
"position": [
1376,
448
],
"parameters": {
"color": 7,
"width": 460,
"height": 326,
"content": "## \ud83c\udfc1 PHASE 4: Archival & Closure\nThis final stage uploads the signed contract and the generated Audit PDF to secure storage. It then updates the CRM status to 'Executed' and notifies the Finance/Legal teams via Slack."
},
"typeVersion": 1
},
{
"id": "f553e596-103a-406a-bd0b-b7d9cd1df8d0",
"name": "Drive: Archive Audit PDF",
"type": "n8n-nodes-base.googleDrive",
"position": [
1408,
624
],
"parameters": {
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "root",
"cachedResultName": "/ (Root folder)"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "0bb66ef7-8491-421f-9371-8d21d7b120b9",
"name": "Slack: Finance Alert",
"type": "n8n-nodes-base.slack",
"position": [
1712,
624
],
"parameters": {
"text": "=\u2705 *Contract Fully Executed*\nClient: {{ $node[\"Code: Approval Router\"].json.clientName }}\nValue: ${{ $node[\"Code: Approval Router\"].json.contractValue }}\nAudit Hash: `{{ $node[\"Code: Audit Metadata\"].json.fingerprint }}`",
"select": "channel",
"channelId": "FINANCE_DEPT",
"otherOptions": {},
"authentication": "oAuth2"
},
"credentials": {
"slackOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "80115a65-bfe5-4af3-ae4b-3a38780290bc",
"name": "Compress PDF1",
"type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
"position": [
1168,
624
],
"parameters": {
"resource": "pdfManipulation",
"operation": "compressPdf"
},
"credentials": {
"htmlcsstopdfApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "f278a2ef-d3e9-448a-9bcc-2fdb3a6c0f0c",
"name": "Update a deal",
"type": "n8n-nodes-base.hubspot",
"position": [
1568,
624
],
"parameters": {
"dealId": {
"__rl": true,
"mode": "list",
"value": ""
},
"resource": "deal",
"operation": "update",
"updateFields": {},
"authentication": "appToken"
},
"credentials": {
"hubspotAppToken": {
"name": "<your credential>"
}
},
"typeVersion": 2.2
},
{
"id": "e61d6ee3-02cf-4e01-b17f-a4a847b1cce6",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
-192
],
"parameters": {
"width": 416,
"height": 624,
"content": "## Enterprise CLM: AI-Optimized Assembly, Multi-Stage Approvals & Audit Governance\n\nEnd-to-end contract automation: Ingestion \u2192 Approval \u2192 Secure Archival.\n\n### \u2699\ufe0f Core Logic\n* **Approvals:** Dynamic 2\u20136 level chains based on contract value.\n* **Optimization:** **HTML to PDF (Compress)** adjusts quality for ISP limits.\n* **Compliance:** Generates an immutable **Audit PDF** with timestamps.\n* **Lifecycle:** Auto-updates HubSpot, archives to Drive, and alerts Slack.\n\n### \ud83d\udccb Quick Setup\n1. **Connect:** HubSpot/Salesforce, Drive, Gmail, and Slack.\n2. **Rules:** Link Airtable/Sheets for approval levels and folder IDs.\n3. **Vault:** Store encryption passwords in a secure Sheet or Env Variable.\n\n**Key Metrics:** `ContractValue`, `AuditHash`, `CompressionRatio`."
},
"typeVersion": 1
}
],
"connections": {
"Compress PDF": {
"main": [
[
{
"node": "Code: Size Validator",
"type": "main",
"index": 0
}
]
]
},
"Compress PDF1": {
"main": [
[
{
"node": "Drive: Archive Audit PDF",
"type": "main",
"index": 0
}
]
]
},
"Update a deal": {
"main": [
[
{
"node": "Slack: Finance Alert",
"type": "main",
"index": 0
}
]
]
},
"Code: Audit Metadata": {
"main": [
[
{
"node": "Compress PDF1",
"type": "main",
"index": 0
}
]
]
},
"Code: Size Validator": {
"main": [
[
{
"node": "Code: Audit Metadata",
"type": "main",
"index": 0
}
]
]
},
"Code: Approval Router": {
"main": [
[
{
"node": "Code: Complexity Engine",
"type": "main",
"index": 0
}
]
]
},
"Code: Complexity Engine": {
"main": [
[
{
"node": "Compress PDF",
"type": "main",
"index": 0
}
]
]
},
"Drive: Archive Audit PDF": {
"main": [
[
{
"node": "Update a deal",
"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.
googleDriveOAuth2ApihtmlcsstopdfApihubspotAppTokenslackOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This industrial-strength Contract Lifecycle Management (CLM) hub provides end-to-end automation for securing, optimizing, and archiving sensitive corporate agreements. It bridges the gap between initial sales triggers and final compliance archival with an AI-driven optimization…
Source: https://n8n.io/workflows/12659/ — 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.
Streamline your month-end accounting processes with this enterprise-grade automation designed to aggregate, validate, and merge fragmented financial documents into a single, professional reporting bun
Optimize your cloud storage costs by using this automation to intelligently compress and migrate aging project documentation. This workflow allows you to achieve a professional data lifecycle policy b
Type in Slack. Walk away. Get a professional PDF report and a structured Excel fix sheet delivered to Google Drive and posted back in your Slack thread — fully automated, zero manual work.
This workflow automates the full company enrichment pipeline: Simply import CSV company lists to Slack and save time on enrichment and CRM maintenance. It processes uploaded files, extracts company do
This workflow is an AI-assisted clean plate and object removal pipeline built for modern VFX production environments. It transforms a single plate image and removal brief into multiple high-quality cl