Skip to main content

Analyze contract PDFs and score risk with Claude 3.5, Postgres, email and Slack alerts

Workflow preview

Workflow preview
100%
Analyze contract PDFs and score risk with Claude 3.5, Postgres, email and Slack alerts preview
Open on n8n.io

1. Workflow Overview

Overview This workflow automates end to end contract analysis using AI. It extracts clauses, evaluates risks, tracks obligations, and generates an executive summary from uploaded contracts. By comb...

Best for

  • Document Extraction automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.set, n8n-nodes-base.extractfromfile, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatanthropic, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.code, n8n-nodes-base.merge

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by ResilNext.

Original n8n.io source

1.1 Workflow description

Title
Analyze contract PDFs and score risk with Claude 3.5, Postgres, email and Slack alerts
Workflow name
Analyze contract PDFs and score risk with Claude 3.5, Postgres, email and Slack alerts

Overview

This workflow automates end-to-end contract analysis using AI. It extracts clauses, evaluates risks, tracks obligations, and generates an executive summary from uploaded contracts.

By combining multiple AI agents with structured parsing and scoring logic, the workflow provides deep legal insights and automatically flags high-risk contracts. It helps legal, compliance, and business teams review contracts faster, reduce risk, and ensure better decision-making.


How It Works

  1. Webhook Trigger
  • Accepts contract uploads via API endpoint.
  1. Workflow Configuration
  • Defines:
  • Risk threshold
  • Alert recipients
  • Slack notification channel
  1. PDF Text Extraction
  • Extracts raw text from uploaded contract files.
  1. Parallel AI Analysis Multiple AI agents process the contract simultaneously:
  • Clause Extraction Agent

  • Identifies and categorizes contract clauses

  • Risk Assessment Agent

  • Evaluates clause-level risks

  • Assigns risk levels and recommendations

  • Obligation Extraction Agent

  • Extracts responsibilities, deadlines, and commitments

  • Executive Summary Agent

  • Generates structured contract summary and insights

  1. Structured Output Parsing
  • Ensures consistent JSON outputs for all agents
  1. Data Aggregation
  • Merges outputs from all AI agents into one dataset
  1. Risk Scoring Engine
  • Calculates weighted risk score based on:
  • Clause types
  • Risk levels
  • Missing critical clauses
  • AI confidence scores
  • Generates:
  • Score breakdown
  • Red flags
  • Recommendations
  1. Data Preparation
  • Formats contract data for storage and tracking
  1. Database Storage
  • Stores:
  • Contract metadata
  • Clauses
  • Obligations
  • Risk scoring results
  1. Risk Evaluation
  • Compares calculated risk score against threshold
  1. Alert System
  • If risk is high:
  • Sends email alerts
  • Sends Slack notifications

Setup Instructions

  1. Webhook Setup
  • Configure endpoint (contract-upload)
  • Connect to your document upload system
  1. AI Model Setup
  • Add Anthropic (Claude 3.5) or OpenAI credentials
  • Connect model to all AI agent nodes
  1. Database Setup
  • Configure Postgres credentials
  • Create tables:
  • contracts
  • contract_clauses
  • contract_obligations
  • risk_scoring
  1. Email Integration
  • Configure Gmail or SMTP credentials
  • Set alert recipient emails
  1. Slack Integration
  • Add Slack credentials
  • Set channel ID for alerts
  1. Configuration Settings
  • Adjust:
  • Risk threshold (e.g., 0.7)
  • Alert recipients
  • Slack channel

Use Cases

  • Legal contract review automation
  • Vendor agreement risk assessment
  • Compliance and audit workflows
  • Procurement contract validation
  • AI-powered legal tech solutions

Requirements

  • AI model API (Anthropic or OpenAI)
  • Postgres database
  • Email service (Gmail/SMTP)
  • Slack workspace
  • n8n instance

Key Features

  • Multi-agent AI contract analysis
  • Clause extraction and categorization
  • Risk scoring with weighted logic
  • Obligation tracking and deadline extraction
  • Executive summary generation
  • Automated high-risk alert system
  • Structured database storage for audit

Summary

A powerful AI-driven contract intelligence workflow that transforms unstructured legal documents into structured insights, risk scores, and actionable recommendations. It enables faster contract reviews, better risk management, and scalable legal automation.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Contract Upload Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 2 - Workflow Configuration

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Extract PDF Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1.1

Block 4 - Clause Extraction Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 5 - Risk Assessment Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 6 - Obligation Extraction Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 7 - Executive Summary Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 8 - Claude 3.5 Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatAnthropic - lmChatAnthropic
Config choices
Version 1.3

Block 9 - Clause Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 10 - Risk Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 11 - Obligation Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 12 - Summary Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 13 - Calculate Risk Score

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Merge Analysis Results

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 15 - Prepare Contract Data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 16 - Insert Contract

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 17 - Insert Clauses

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 18 - Insert Obligations

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 19 - Insert Risk Scoring

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 20 - Check Risk Level

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 21 - Send Email Alert

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.2

Block 22 - Send Slack Alert

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.4

Block 23 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 36 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Analyze contract PDFs and score risk with Claude 3.5, Postgres, email and Slack alerts
Complexity advanced
Nodes 36
Categories Document Extraction, AI Summarization
Author ResilNext
Published 06 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14823/14823.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Analyze contract PDFs and score risk with Claude 3.5, Postgres, email and Slack alerts do?

Overview This workflow automates end to end contract analysis using AI. It extracts clauses, evaluates risks, tracks obligations, and generates an executive summary from uploaded contracts. By comb...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Summarization use case.