🔬 Detect contract compliance violations with Notion, Google Sheets and Groq

⚡ 0 views · 🔬 Document Extraction & Analysis

Description

Quick overview

This workflow runs daily to compare procurement transactions in Google Sheets against active contract terms stored in Notion, flags pricing/SLA/volume violations with calculated leakage, and uses Groq LLM analysis to generate corrective recommendations that are logged back to Google Sheets.

How it works

  1. Runs every day at 6:00 AM on a schedule.
  2. Retrieves all active contract records from a Notion database.
  3. Pulls recent procurement transactions from Google Sheets and compares each transaction to the matching contract SKU to detect pricing overcharges, SLA breaches, volume threshold issues, or missing contracts, calculating per-transaction leakage.
  4. Appends compliant transactions to a dedicated Google Sheets tab for audit tracking.
  5. For violations, loads historical violation logs from Google Sheets and calculates vendor/SKU recurrence counts and cumulative leakage to estimate total impact.
  6. Processes each current violation through Groq Chat to produce a structured impact assessment, urgency, and corrective recommendation.
  7. Appends the violation details, calculated leakage, and AI recommendation to the Google Sheets “Violation Logs” audit sheet.

Setup

  1. Add Notion credentials and select the Notion database that contains your contract records, including fields for SKU, agreed price, SLA days, volume threshold, contract ID, and an “Active” status.
  2. Add Google Sheets credentials and set the spreadsheet and sheet tabs used for input transactions, compliant transaction logging, and violation logging.
  3. Add a Groq API credential for the LangChain Groq Chat model used to generate structured recommendations.
  4. Ensure your Google Sheets transaction columns match the workflow’s expected headers (for example: Transaction ID, Date, Vendor, Item SKU, Quantity Purchased, Unit Price Paid, and Actual Delivery Days).

Additional info

How To Customize Nodes

Add‑ons

To expand the functionality of this workflow, consider adding:

Use Case Examples

This workflow handles multiple procurement scenarios simultaneously. Primary use cases include:

Troubleshooting Guide

IssuePossible CauseSolution
Workflow misses contract matchesNaming discrepancies between Notion and Google Sheets.Check for trailing spaces or case-sensitivity issues. The Compare Terms vs Actuals node requires an exact text match on the SKU fields.
Code node returns NaN for leakageQuantity or Price fields in Google Sheets are formatted as text.Ensure numeric columns in Google Sheets are strictly formatted as numbers, or update the JS code to parse strings into floats.
AI Node times out or throws schema errorsGroq API rate limits reached or unexpected LLM output.Verify your Groq API credentials. If the model fails to parse JSON, consider switching to a different supported model like Llama 3 within the Groq node.
Slack alerts are not sendingIncorrect Channel ID or missing app permissions.Re-authenticate the Slack node and ensure the n8n bot is invited to the target channel.

Need Help?

Building reliable, automated compliance engines requires a deep understanding of data validation, API integration and custom business logic.

If you need assistance configuring your Notion databases, customizing the JavaScript leakage formulas, integrating this workflow into your native ERP system or building similar supply chain automations, please contact WeblineIndia. Our team of technical integration experts can help you design, scale and maintain tailored automation workflows for your entire business.

đź”— Nodes Used

Google Sheets, Notion, Schedule Trigger, Basic LLM Chain, Structured Output Parser, Groq Chat Model

📥 Import

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

📖 Importing guide · 🔑 Credential setup