Quick overview
This workflow monitors a Google Drive folder for new NDA files, extracts their text, uses OpenAI to extract and assess clauses against a Google Sheets playbook, then either auto-approves and files the document or escalates it to legal review with an email and audit logging.
How it works
- Triggers when a new file is created in a specified Google Drive “Incoming” folder.
- Downloads the file from Google Drive, generates an NDA ID, and checks whether the file type is supported (PDF or DOCX).
- Moves supported files to a Google Drive “Processing” folder, re-downloads the moved file, and extracts the document text.
- If there is enough extractable text, OpenAI parses the NDA into structured JSON clauses and document metadata.
- Loads the NDA review playbook from Google Sheets and sends both the playbook and extracted clauses to OpenAI to produce a risk assessment and recommendation.
- Applies deterministic approval rules to decide AUTO_APPROVED versus LEGAL_REVIEW based on risk level, risk score, confidence, deviations, and blocking issues.
- Moves the file to either an “Approved” or “Legal Review” Google Drive folder and appends an audit entry to Google Sheets, emailing the legal team when legal review is required.
Setup
- Connect Google Drive OAuth2 credentials and set the Incoming, Processing, Approved, and Legal Review folder IDs used by the trigger and move actions.
- Connect a Google Sheets OAuth2 credential and update the spreadsheet ID/sheet tabs used for the playbook and the audit log.
- Add an OpenAI API credential and confirm the model selection (gpt-4o-mini) matches your account access.
- Configure SMTP credentials and update the “to” and “from” email addresses used for legal review notifications.
- Ensure incoming NDAs are PDFs (and note that DOCX is marked supported but the current extraction step is configured for PDF text extraction only).
Requirements
-Google Drive
-OpenAI
-Google Sheeet
Required Credentials
-Google Drive OAuth2
-OpenAI API
-Google Sheets OAuth2
Required Inputs
-NDA documents in PDF or DOCX format
-Legal playbook maintained in Google Sheets
Recommended Permissions
-Read access to incoming NDA folders
-Write access to processing and archive folders
-Edit access to the NDA playbook spreadsheet
Customization
Customize:
-Required clauses
-Preferred language
-Acceptable clause variations
-Risk levels
-Auto-approval criteria
Approval Rules
Modify conditions for:
-Auto approval
-Legal review
-Risk scoring
-Confidence threshold
-Blocking issues
Supported Documents
Extend support for:
-NDAs
-Mutual NDAs
-Vendor NDAs
-Customer NDAs
-Employment confidentiality agreements
AI Analysis
Customize extraction to review:
-Confidentiality terms
-Term lengths
-Jurisdiction clauses
-Data protection obligations
-Disclosure restrictions
-Non-solicitation clauses
Audit & Compliance
Extend the workflow to:
-Notify legal teams
-Create Jira tickets
-Generate PDF review reports
-Archive approved agreements