エンタープライズ契約ライフサイクル管理とAIによるリスク分析
上級
これはDocument Extraction, AI Summarization分野の自動化ワークフローで、20個のノードを含みます。主にIf, Code, Merge, Slack, Postgresなどのノードを使用。 エンタープライズ契約ライフサイクル管理とAIリスク解析
前提条件
- •Slack Bot Token または Webhook URL
- •PostgreSQLデータベース接続情報
- •Salesforce OAuth認証情報
- •Google Drive API認証情報
使用ノード (20)
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"meta": {
"instanceId": "placeholder"
},
"nodes": [
{
"id": "workflow-overview",
"name": "ワークフロー概要",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
50
],
"parameters": {
"width": 320,
"height": 180,
"content": "## Enterprise Contract Lifecycle Management\n\nThis workflow orchestrates:\n- Multi-channel contract intake\n- AI-powered extraction & analysis\n- Risk scoring & compliance checks\n- Approval routing & notifications\n- CRM integration & analytics\n- Obligation tracking & alerts"
},
"typeVersion": 1
},
{
"id": "email-trigger",
"name": "契約関連メールの監視",
"type": "n8n-nodes-base.emailReadImap",
"notes": "Monitor email for contracts",
"position": [
250,
200
],
"parameters": {
"mailbox": "INBOX",
"options": {
"customEmailConfig": "contractreview@company.com"
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 2
},
{
"id": "drive-trigger",
"name": "Google ドライブの監視",
"type": "n8n-nodes-base.googleDriveTrigger",
"notes": "Watch for new contracts",
"position": [
250,
350
],
"parameters": {
"events": [
"file:created",
"file:updated"
],
"folderID": "contracts-intake"
},
"typeVersion": 1
},
{
"id": "schedule-trigger",
"name": "毎時のCRMチェック",
"type": "n8n-nodes-base.scheduleTrigger",
"notes": "Check CRM for contracts",
"position": [
250,
500
],
"parameters": {
"unit": "hours",
"value": 1,
"events": [
"workflowActivate"
]
},
"typeVersion": 1
},
{
"id": "salesforce-check",
"name": "Salesforce の確認",
"type": "n8n-nodes-base.salesforce",
"notes": "Get contracts from CRM",
"position": [
450,
500
],
"parameters": {
"filters": {
"stage": "Contract Review",
"lastModified": "={{ $now.minus({hours: 1}).toISO() }}"
},
"resource": "opportunity",
"operation": "getAll"
},
"typeVersion": 2
},
{
"id": "merge-sources",
"name": "契約情報ソースの統合",
"type": "n8n-nodes-base.merge",
"position": [
650,
350
],
"parameters": {
"mode": "multiplex",
"options": {}
},
"typeVersion": 2.1
},
{
"id": "check-duplicate",
"name": "重複チェック",
"type": "n8n-nodes-base.postgres",
"notes": "Prevent reprocessing",
"position": [
850,
350
],
"parameters": {
"query": "SELECT contract_id FROM contracts WHERE hash = '{{ $json.fileHash }}' LIMIT 1",
"operation": "executeQuery"
},
"typeVersion": 2.4
},
{
"id": "is-new-contract",
"name": "新規契約?",
"type": "n8n-nodes-base.if",
"position": [
1050,
350
],
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json.contract_id }}",
"operation": "isEmpty"
}
]
}
},
"typeVersion": 1
},
{
"id": "extract-contract",
"name": "PDFベクトル - 全データ抽出",
"type": "n8n-nodes-pdfvector.pdfVector",
"notes": "AI extraction of 50+ fields",
"position": [
1250,
350
],
"parameters": {
"prompt": "Extract comprehensive contract information including all parties (with roles, addresses, registration numbers), contract metadata (type, value, currency, effective/expiration dates), payment terms (amounts, schedules, penalties), deliverables and milestones, obligations for each party, termination conditions, liability caps, indemnification clauses, intellectual property provisions, confidentiality terms, force majeure, governing law, dispute resolution, and any special conditions. Also identify if this is a master agreement with SOWs.",
"schema": "{\"type\":\"object\",\"properties\":{\"contractId\":{\"type\":\"string\"},\"contractType\":{\"type\":\"string\"},\"masterAgreement\":{\"type\":\"boolean\"},\"parties\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"role\":{\"type\":\"string\"},\"type\":{\"type\":\"string\"},\"address\":{\"type\":\"string\"},\"registrationNumber\":{\"type\":\"string\"},\"signatory\":{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"email\":{\"type\":\"string\"}}}}}},\"contractValue\":{\"type\":\"object\",\"properties\":{\"total\":{\"type\":\"number\"},\"currency\":{\"type\":\"string\"},\"paymentStructure\":{\"type\":\"string\"}}},\"term\":{\"type\":\"object\",\"properties\":{\"effectiveDate\":{\"type\":\"string\"},\"expirationDate\":{\"type\":\"string\"},\"autoRenewal\":{\"type\":\"boolean\"},\"renewalNotice\":{\"type\":\"number\"}}},\"paymentTerms\":{\"type\":\"object\",\"properties\":{\"schedule\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"amount\":{\"type\":\"number\"},\"dueDate\":{\"type\":\"string\"},\"milestone\":{\"type\":\"string\"}}}},\"lateFees\":{\"type\":\"string\"},\"earlyPaymentDiscount\":{\"type\":\"string\"}}},\"deliverables\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"description\":{\"type\":\"string\"},\"dueDate\":{\"type\":\"string\"},\"acceptanceCriteria\":{\"type\":\"string\"},\"party\":{\"type\":\"string\"}}}},\"obligations\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"party\":{\"type\":\"string\"},\"obligation\":{\"type\":\"string\"},\"frequency\":{\"type\":\"string\"},\"deadline\":{\"type\":\"string\"}}}},\"termination\":{\"type\":\"object\",\"properties\":{\"forConvenience\":{\"type\":\"boolean\"},\"notice\":{\"type\":\"number\"},\"penaltiesForEarlyTermination\":{\"type\":\"string\"},\"terminationTriggers\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}},\"liability\":{\"type\":\"object\",\"properties\":{\"limitationOfLiability\":{\"type\":\"string\"},\"indemnification\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"insurance\":{\"type\":\"string\"}}},\"intellectualProperty\":{\"type\":\"object\",\"properties\":{\"ownership\":{\"type\":\"string\"},\"licenses\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"workForHire\":{\"type\":\"boolean\"}}},\"confidentiality\":{\"type\":\"object\",\"properties\":{\"duration\":{\"type\":\"string\"},\"exceptions\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}},\"disputeResolution\":{\"type\":\"string\"},\"governingLaw\":{\"type\":\"string\"},\"specialClauses\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"contractType\",\"parties\"],\"additionalProperties\":false}",
"resource": "document",
"inputType": "file",
"operation": "extract",
"binaryPropertyName": "data"
},
"typeVersion": 1
},
{
"id": "risk-analysis",
"name": "PDFベクトル - リスク分析",
"type": "n8n-nodes-pdfvector.pdfVector",
"notes": "Multi-dimensional risk scoring",
"position": [
1450,
350
],
"parameters": {
"prompt": "Perform comprehensive risk analysis on this contract considering: 1) Legal risks (unusual terms, missing standard clauses, jurisdiction issues), 2) Financial risks (payment terms, penalties, uncapped liabilities), 3) Operational risks (unrealistic deadlines, resource requirements, dependencies), 4) Compliance risks (regulatory requirements, data protection, export controls), 5) Relationship risks (one-sided terms, termination difficulties). Provide risk scores (1-10) for each category and an overall risk rating with specific concerns.",
"resource": "document",
"inputType": "file",
"operation": "ask",
"binaryPropertyName": "data"
},
"typeVersion": 1
},
{
"id": "get-template",
"name": "契約テンプレートの取得",
"type": "n8n-nodes-base.postgres",
"notes": "Retrieve standard template",
"position": [
1650,
250
],
"parameters": {
"query": "SELECT template_id, clauses FROM contract_templates WHERE contract_type = '{{ $json.contractType }}' AND active = true",
"operation": "executeQuery"
},
"typeVersion": 2.4
},
{
"id": "analyze-score",
"name": "契約分析とスコアリング",
"type": "n8n-nodes-base.code",
"notes": "Comprehensive analysis engine",
"position": [
1850,
350
],
"parameters": {
"jsCode": "// Advanced contract analysis and scoring\nconst extracted = $node['PDF Vector - Extract All Data'].json.data;\nconst riskAnalysis = JSON.parse($node['PDF Vector - Risk Analysis'].json.answer);\nconst template = $node['Get Contract Template'].json;\nconst crmData = $node['Check Salesforce'].json;\n\n// Calculate comprehensive risk score\nlet riskFactors = [];\nlet totalRiskScore = 0;\n\n// Financial risk scoring\nconst contractValue = extracted.contractValue?.total || 0;\nconst annualRevenue = crmData.account?.annualRevenue || 1000000;\nconst dealSizeRisk = (contractValue / annualRevenue) > 0.1 ? 8 : 3;\nriskFactors.push({category: 'Deal Size', score: dealSizeRisk});\n\n// Check for missing standard clauses\nconst missingClauses = [];\nif (!extracted.liability?.limitationOfLiability) {\n missingClauses.push('Limitation of Liability');\n riskFactors.push({category: 'Missing LoL', score: 9});\n}\nif (!extracted.termination?.forConvenience) {\n missingClauses.push('Termination for Convenience');\n riskFactors.push({category: 'No Exit Clause', score: 7});\n}\n\n// Payment term risks\nif (extracted.paymentTerms?.schedule?.[0]?.dueDate) {\n const firstPayment = new Date(extracted.paymentTerms.schedule[0].dueDate);\n const daysToPay = (firstPayment - new Date()) / (1000 * 60 * 60 * 24);\n if (daysToPay > 60) {\n riskFactors.push({category: 'Extended Payment Terms', score: 6});\n }\n}\n\n// Auto-renewal risk\nif (extracted.term?.autoRenewal && extracted.term?.renewalNotice < 30) {\n riskFactors.push({category: 'Short Renewal Notice', score: 7});\n}\n\n// Calculate weighted risk score\ntotalRiskScore = riskFactors.reduce((sum, risk) => sum + risk.score, 0) / riskFactors.length;\n\n// Determine approval level\nlet approvalLevel = 'Manager';\nif (totalRiskScore > 7 || contractValue > 1000000) approvalLevel = 'Director';\nif (totalRiskScore > 8 || contractValue > 5000000) approvalLevel = 'VP';\nif (missingClauses.includes('Limitation of Liability')) approvalLevel = 'Legal';\n\n// Calculate key dates and alerts\nconst alerts = [];\nconst today = new Date();\n\n// Contract expiration alert\nif (extracted.term?.expirationDate) {\n const expDate = new Date(extracted.term.expirationDate);\n const daysToExpire = (expDate - today) / (1000 * 60 * 60 * 24);\n if (daysToExpire < 90) {\n alerts.push({\n type: 'Contract Expiration',\n date: extracted.term.expirationDate,\n daysRemaining: Math.floor(daysToExpire),\n severity: daysToExpire < 30 ? 'High' : 'Medium'\n });\n }\n}\n\n// Deliverable alerts\nif (extracted.deliverables) {\n extracted.deliverables.forEach(deliverable => {\n const dueDate = new Date(deliverable.dueDate);\n const daysToDue = (dueDate - today) / (1000 * 60 * 60 * 24);\n if (daysToDue > 0 && daysToDue < 30) {\n alerts.push({\n type: 'Upcoming Deliverable',\n description: deliverable.description,\n date: deliverable.dueDate,\n daysRemaining: Math.floor(daysToDue),\n severity: daysToDue < 7 ? 'High' : 'Medium'\n });\n }\n });\n}\n\nreturn [{\n json: {\n contractAnalysis: {\n contractId: extracted.contractId || `AUTO-${Date.now()}`,\n type: extracted.contractType,\n parties: extracted.parties,\n value: contractValue,\n currency: extracted.contractValue?.currency || 'USD',\n effectiveDate: extracted.term?.effectiveDate,\n expirationDate: extracted.term?.expirationDate\n },\n riskAssessment: {\n overallScore: totalRiskScore,\n riskLevel: totalRiskScore > 7 ? 'High' : totalRiskScore > 4 ? 'Medium' : 'Low',\n riskFactors: riskFactors,\n missingClauses: missingClauses,\n aiRiskAnalysis: riskAnalysis\n },\n approvalRouting: {\n level: approvalLevel,\n reason: riskFactors.filter(r => r.score > 6).map(r => r.category).join(', ')\n },\n alerts: alerts,\n crmAlignment: {\n opportunityId: crmData.id,\n accountName: crmData.account?.name,\n dealSize: crmData.amount,\n stage: crmData.stage\n },\n metadata: {\n sourceChannel: $input.first().json.sourceChannel || 'Unknown',\n receivedDate: new Date().toISOString(),\n fileHash: $json.fileHash\n },\n fullExtraction: extracted\n }\n}];"
},
"typeVersion": 2
},
{
"id": "save-contract",
"name": "契約リポジトリへの保存",
"type": "n8n-nodes-base.postgres",
"notes": "Central contract database",
"position": [
2050,
350
],
"parameters": {
"table": "contracts",
"values": "={{ $json.contractAnalysis.contractId }},={{ $json.contractAnalysis.type }},={{ JSON.stringify($json.contractAnalysis.parties) }},={{ $json.contractAnalysis.value }},={{ $json.contractAnalysis.effectiveDate }},={{ $json.contractAnalysis.expirationDate }},={{ $json.riskAssessment.overallScore }},={{ $json.riskAssessment.riskLevel }},={{ $json.approvalRouting.level }},={{ JSON.stringify($json.fullExtraction) }},={{ JSON.stringify($json.riskAssessment) }},={{ JSON.stringify($json.alerts) }},={{ JSON.stringify($json.crmAlignment) }},={{ $now.toISO() }},pending_approval",
"columns": "contract_id,type,parties,value,effective_date,expiration_date,risk_score,risk_level,approval_level,extracted_data,risk_analysis,alerts,crm_data,created_at,status",
"operation": "insert"
},
"typeVersion": 2.4
},
{
"id": "needs-legal",
"name": "法務レビュー必要?",
"type": "n8n-nodes-base.if",
"position": [
2250,
350
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.riskAssessment.riskLevel }}",
"value2": "High",
"operation": "equals"
}
],
"boolean": [
{
"value1": "={{ $json.riskAssessment.missingClauses.length > 0 }}",
"value2": true
}
]
},
"combineOperation": "any"
},
"typeVersion": 1
},
{
"id": "notify-legal",
"name": "法務チームへの通知",
"type": "n8n-nodes-base.slack",
"notes": "High risk alert",
"position": [
2450,
450
],
"parameters": {
"text": "⚠️ High Risk Contract Requires Review",
"channel": "#legal-contracts",
"attachments": [
{
"ts": "={{ Date.now() / 1000 }}",
"color": "#ff0000",
"title": "{{ $json.contractAnalysis.type }} - {{ $json.contractAnalysis.parties[0].name }}",
"fields": {
"item": [
{
"short": true,
"title": "Contract Value",
"value": "{{ $json.contractAnalysis.currency }} {{ $json.contractAnalysis.value.toLocaleString() }}"
},
{
"short": true,
"title": "Risk Score",
"value": "{{ $json.riskAssessment.overallScore }}/10"
},
{
"short": false,
"title": "Risk Factors",
"value": "{{ $json.riskAssessment.riskFactors.filter(r => r.score > 6).map(r => r.category).join('\\n') }}"
},
{
"short": false,
"title": "Missing Clauses",
"value": "{{ $json.riskAssessment.missingClauses.join('\\n') || 'None' }}"
}
]
},
"footer": "Contract Review System",
"title_link": "https://contracts.company.com/review/{{ $json.contractAnalysis.contractId }}"
}
]
},
"typeVersion": 2.1
},
{
"id": "update-salesforce",
"name": "Salesforce の更新",
"type": "n8n-nodes-base.salesforce",
"notes": "Sync with CRM",
"position": [
2450,
250
],
"parameters": {
"resource": "opportunity",
"operation": "update",
"updateFields": {
"customFields": {
"Contract_ID__c": "={{ $json.contractAnalysis.contractId }}",
"Contract_Status__c": "Under Review",
"Contract_Expiration__c": "={{ $json.contractAnalysis.expirationDate }}",
"Contract_Risk_Score__c": "={{ $json.riskAssessment.overallScore }}"
}
},
"opportunityId": "={{ $json.crmAlignment.opportunityId }}"
},
"typeVersion": 2
},
{
"id": "daily-alerts",
"name": "デイリーアラートチェック",
"type": "n8n-nodes-base.scheduleTrigger",
"notes": "Check for upcoming deadlines",
"position": [
250,
650
],
"parameters": {
"unit": "days",
"value": 1,
"events": [
"workflowActivate"
]
},
"typeVersion": 1
},
{
"id": "get-alerts",
"name": "近日予定アラートの取得",
"type": "n8n-nodes-base.postgres",
"notes": "Find contracts with deadlines",
"position": [
450,
650
],
"parameters": {
"query": "SELECT c.*, json_array_elements(c.alerts) as alert FROM contracts c WHERE c.status = 'active' AND (alert->>'date')::date BETWEEN CURRENT_DATE AND CURRENT_DATE + INTERVAL '30 days'",
"operation": "executeQuery"
},
"typeVersion": 2.4
},
{
"id": "send-daily-summary",
"name": "デイリーサマリー送信",
"type": "n8n-nodes-base.slack",
"notes": "Daily deadline digest",
"position": [
650,
650
],
"parameters": {
"text": "=📅 Daily Contract Alert Summary\\n\\nYou have {{ $items.length }} upcoming contract deadlines:\\n\\n{{ $items.map(item => `• ${item.json.alert.type}: ${item.json.alert.description || item.json.contract_id} - Due ${item.json.alert.date} (${item.json.alert.daysRemaining} days)`).join('\\n') }}",
"select": "channel",
"channelId": {
"__rl": true,
"value": "contract-alerts"
},
"authentication": "oAuth2"
},
"typeVersion": 2.1
},
{
"id": "analytics-note",
"name": "分析ダッシュボード",
"type": "n8n-nodes-base.stickyNote",
"position": [
2650,
350
],
"parameters": {
"width": 300,
"height": 200,
"content": "=Contract Analytics Dashboard\\n\\nTotal Contracts: {{ $json.totalContracts }}\\nTotal Value: ${{ $json.totalValue.toLocaleString() }}\\nHigh Risk: {{ $json.highRisk }}\\nExpiring Soon: {{ $json.expiringSoon }}\\n\\nView full dashboard: https://analytics.company.com/contracts"
},
"typeVersion": 1
}
],
"connections": {
"is-new-contract": {
"main": [
[
{
"node": "extract-contract",
"type": "main",
"index": 0
}
],
[]
]
},
"check-duplicate": {
"main": [
[
{
"node": "is-new-contract",
"type": "main",
"index": 0
}
]
]
},
"salesforce-check": {
"main": [
[
{
"node": "merge-sources",
"type": "main",
"index": 0
}
]
]
},
"schedule-trigger": {
"main": [
[
{
"node": "salesforce-check",
"type": "main",
"index": 0
}
]
]
},
"daily-alerts": {
"main": [
[
{
"node": "get-alerts",
"type": "main",
"index": 0
}
]
]
},
"get-alerts": {
"main": [
[
{
"node": "send-daily-summary",
"type": "main",
"index": 0
}
]
]
},
"needs-legal": {
"main": [
[
{
"node": "notify-legal",
"type": "main",
"index": 0
}
],
[]
]
},
"drive-trigger": {
"main": [
[
{
"node": "merge-sources",
"type": "main",
"index": 0
}
]
]
},
"get-template": {
"main": [
[
{
"node": "analyze-score",
"type": "main",
"index": 0
}
]
]
},
"merge-sources": {
"main": [
[
{
"node": "check-duplicate",
"type": "main",
"index": 0
}
]
]
},
"email-trigger": {
"main": [
[
{
"node": "merge-sources",
"type": "main",
"index": 0
}
]
]
},
"analyze-score": {
"main": [
[
{
"node": "save-contract",
"type": "main",
"index": 0
}
]
]
},
"risk-analysis": {
"main": [
[
{
"node": "analyze-score",
"type": "main",
"index": 0
}
]
]
},
"save-contract": {
"main": [
[
{
"node": "needs-legal",
"type": "main",
"index": 0
},
{
"node": "update-salesforce",
"type": "main",
"index": 0
}
]
]
},
"extract-contract": {
"main": [
[
{
"node": "risk-analysis",
"type": "main",
"index": 0
},
{
"node": "get-template",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
上級 - 文書抽出, AI要約
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
PDFベクトル、Google Drive、データベースを使用した領秤データの抽出と保存
PDFベクトル、Google Drive、データベースを使って領収書データを抽出・保存する
If
Code
Slack
+
If
Code
Slack
26 ノードPDF Vector
請求書処理
PDF VectorとHIPAA準拠で医療文書から臨床データを抽出
PDF Vector と HIPAA 準拠を使用して医療文書から臨床データを抽出
If
Code
Postgres
+
If
Code
Postgres
9 ノードPDF Vector
文書抽出
PDF Vector AIで文書から法律引用を抽出・検証
PDF Vector AIでドキュメントから法引用を抽出し、検証する
If
Code
Google Drive
+
If
Code
Google Drive
8 ノードPDF Vector
文書抽出
GPT-4と複数のデータベース検索を使った学術文献综述の自動化
GPT-4と複数のデータベース検索を使った学術文献レビューの自動化
If
Set
Code
+
If
Set
Code
13 ノードPDF Vector
文書抽出
GPT-4、PDFVector、PostgreSQLエクスポートを使用して文書からデータを抽出
ドキュメントからデータをGPT-4、PDFVector、PostgreSQLで出力する
Code
Open Ai
Switch
+
Code
Open Ai
Switch
9 ノードPDF Vector
文書抽出
GPT-4とApifyを基盤としたAI駆動型競合他社・市場インテリジェンスシステム
GPT-4とApifyを基盤としたAI駆動型競合他社・市場インテリジェンスシステム
Code
Merge
Slack
+
Code
Merge
Slack
12 ノードMarth
市場調査
ワークフロー情報
難易度
上級
ノード数20
カテゴリー2
ノードタイプ11
作成者
PDF Vector
@pdfvectorA fully featured PDF APIs for developers - Parse any PDF or Word document, extract structured data, and access millions of academic papers - all through simple APIs.
外部リンク
n8n.ioで表示 →
このワークフローを共有