🔬 Review contract risk and rewrite clauses with Groq, Google Drive, Notion, and Slack

⚡ 27 views · 🔬 Document Extraction & Analysis

Description

Quick overview

This workflow watches a Google Drive folder for newly uploaded contract PDFs, extracts key clauses with Groq-hosted LLMs, compares them to standard clauses stored in Notion, generates a structured risk report and clause rewrites, sends a Slack alert for high-risk contracts, and saves the review to Notion.

How it works

  1. Triggers when a new file is created in a specific Google Drive folder.
  2. Downloads the file and extracts text from it (using PDF text extraction when the uploaded file is a PDF).
  3. Uses a Groq-hosted LLM to extract key contract clauses (payment terms, penalties, SLA, termination, renewal, liability, and data protection) into structured JSON.
  4. Pulls the company’s standard clause library from Notion and compares each extracted vendor clause to the corresponding standard text.
  5. Uses a Groq-hosted LLM to generate a structured legal risk report with an overall risk level, executive summary, clause-by-clause risk review, missing protections, and negotiation recommendations.
  6. Rewrites medium- and high-risk clauses with a Groq-hosted LLM to produce negotiation-ready alternative wording aligned to the Notion standards.
  7. If the overall risk level is High, posts a formatted alert to Slack, and then creates a contract review record in Notion containing the risk summary, recommendations, and revised clauses.

Setup

  1. Connect Google Drive OAuth credentials and set the folder to watch for uploaded contracts.
  2. Connect your Groq API credentials for the clause extraction, risk analysis, and clause rewrite LLM steps.
  3. Connect Notion credentials and select the correct databases for the Standard Clause Library and Contract Reviews, ensuring clause type values match (Payment Terms, Penalties, SLA, Termination, Renewal, Liability, Data Protection).
  4. Connect Slack OAuth credentials and set the target channel for high-risk contract alerts.
  5. Upload contracts as PDFs (or ensure non-PDF files contain readable text content) so the extraction step has usable contract text.

Additional info

How To Customize Nodes

Add‑ons

Use Case Examples

Troubleshooting Guide

IssuePossible CauseSolution
Workflow doesn’t startGoogle Drive Trigger isn’t polling.Ensure the node is “Active” and the folder ID is correct.
Notion Error (404/400)Missing database properties.Verify that property_clause_type and other fields match exactly (case-sensitive).
Groq API TimeoutContract text is too long.Use a “Text Splitter” node or ensure the Groq model supports the token count of your contract.
Extraction is BlankNon-searchable PDF (Scanned Image).Use an OCR node before the extraction node to convert images to text.
Slack Node ErrorChannel ID changed.Re-select the channel from the dropdown in the Slack node settings.

Need Help?

Setting up automated legal logic can be complex. If you need a hand configuring your Notion databases, customizing the AI prompts or building out additional features like automated vendor replies, our n8n automation developers are here to help.

Contact WeblineIndia to connect with our n8n experts for a custom-built automation solution tailored to your business needs.

đź”— Nodes Used

Slack, Google Drive, Notion, Google Drive Trigger, Basic LLM Chain, Structured Output Parser

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup