Auto-triage contract emails: classify with OpenAI, OCR attachments, start PandaDoc signature flows, log metadata to Notion, and notify Slack using Make.com.
Introduction
Contracts arrive by email, attachments sit in threads, and someone must open each file, decide if it is a contract, extract key fields, and start the signature process. That manual triage is slow, error prone, and leaves no consistent audit trail.
This guide shows an advanced Make.com scenario that automates contract triage end to end. The flow watches a Gmail label, saves attachments to Google Drive, runs OCR when needed, asks OpenAI to classify the message and extract structured contract fields, starts a PandaDoc signature flow when appropriate, logs the metadata into Notion, and posts a concise alert into Slack. By the end you will have a production-ready pattern with idempotency, human-review routing, and auditing.
What You'll Need
- Make.com account with connections for Gmail, Google Drive, HTTP/OpenAI, Google Cloud Vision (or similar OCR), PandaDoc, Notion, and Slack. Paid Make.com plan recommended for webhook reliability and retries.
- Gmail account with a dedicated label (for example triage/contracts) and OAuth access for Make.com.
- OpenAI API key (monitor rate limits and use prompt caching where helpful).
- PandaDoc account with API access for creating and sending documents.
- Notion integration token and a database configured to store contract records and status.
- Google Drive folder for temporary storage of attachments and raw OCR output.
- A clear list of contract fields to extract, for example: counterparty_name, contract_type, contract_value, effective_date, termination_date, signature_required, suggested_reviewer_team.
Note: PandaDoc and OpenAI incur usage costs. Plan and budget accordingly.
How It Works (The Logic)
Trigger (new Gmail message with label) → Save attachments to Drive → If attachment is image/PDF use Google Cloud Vision OCR → Build a text payload (email snippet + OCR text) and send to OpenAI with a strict prompt that returns JSON → Validate JSON and check confidence → If is_contract == yes, create or attach a PandaDoc document and send for signature if data is sufficient → Write or update a Notion database record with metadata and links → Post a Slack notification to the suggested reviewer team or escalate when needed.
In short: Gmail → Drive → OCR → OpenAI classifier/extractor → PandaDoc signature → Notion log → Slack alert.
Step-by-Step Setup
- Prepare Gmail and choose the trigger
- Create a Gmail label like triage/contracts and use Gmail filters to route likely contract emails into it. This reduces noise.
- In Make.com use Gmail "Watch emails" with the query "label:triage/contracts is:unread" so each message is handled once.
Gotcha: using the whole inbox will process many irrelevant messages and waste API operations.
- Upload attachments and an email snapshot to Google Drive
- Add a Google Drive "Upload a file" module for each attachment. Store them in a folder named with the message ID or date for traceability.
- Also create a small JSON metadata file (message_id, thread_id, from, subject) and upload it so raw input is archived.
Use the Gmail message ID as your unique key throughout the scenario.
- Extract text from attachments using OCR when needed
- If attachments are native text PDFs or DOCX, use a direct extractor when available. For image-based PDFs or images call Google Cloud Vision documentTextDetection.
- Keep full OCR output in Drive for audit, then trim the text to the first 2,500–3,000 characters to feed into the LLM.
Gotcha: OCR is noisy. Preserve the raw output and only send a cleaned snippet to the model.
- Build the OpenAI prompt and call the API
- Use the HTTP or OpenAI module. Prompt must require a strictly formatted JSON response. Provide these keys: is_contract (yes/no), contract_type (nda, sow, purchase, msla, other), counterparty_name, contract_value (number+currency or null), effective_date, termination_date, signature_required (yes/no), suggested_reviewer_team (legal, finance, sales), confidence_score (0.0-1.0).
- Include the email subject, the first 1,500 characters of the email body, and the first 3,000 characters of the OCR text. Ask the model to return null for unknown fields, and set temperature to 0.0 for deterministic output.
Prompt example fragment: "Return only JSON with these keys. Use null when unknown. Do not add commentary."
Validation: parse the JSON in Make.com, ensure keys exist, and check confidence_score. If parsing fails or confidence_score < 0.6, route the item to manual review.
- De-duplication and Notion pre-check
- Query your Notion database for a record with the same message_id or the same counterparty_name + effective_date to prevent duplicates.
- If a Notion record exists with status sent_for_signature or completed, stop processing to avoid duplicate signature flows.
This prevents reprocessing when Make.com retries or an email is re-labelled.
- Create or attach a PandaDoc document when appropriate
- Option A: If the attachment is a final PDF, use PandaDoc's "Create document from file" endpoint and add recipients mapped from the extracted fields.
- Option B: If you use a template, create a PandaDoc document from template and populate merge fields with the extracted JSON values.
Map recipient fields carefully. PandaDoc expects recipients as structured arrays with role and email. If OpenAI cannot find an email, set status to manual_review and create a Notion task.
Gotcha: PandaDoc API requires explicit recipient role and email. Missing email means a manual step.
- Update Notion with structured metadata and links
- Create or update a Notion database entry with properties: message_id, subject, from_email, counterparty_name, contract_type, contract_value, effective_date, termination_date, panda_doc_id, drive_file_ids, status (triaged, sent_for_signature, manual_review), confidence_score, created_at, triage_notes.
- Include direct links to Gmail, Drive files, and the PandaDoc document for auditors and reviewers.
This becomes your single source of truth for inbound contracts.
- Post Slack notifications and route reviewers
- Post a message to the appropriate Slack channel based on suggested_reviewer_team, or direct message the legal lead for high-value or high-urgency contracts.
Message template example:
New contract triaged: {{counterparty_name || "unknown"}}
Type: {{contract_type}} • Value: {{contract_value || "unknown"}}
Reviewer: {{suggested_reviewer_team}} • Confidence: {{confidence_score}}
Notion: {{notion_record_link}} • PandaDoc: {{panda_doc_link || "not created"}}
Only send to broad channels for items that require team visibility. For routine NDAs send a private DM to the assigned reviewer.
- Manual review and escalation
- If the OpenAI output is low confidence or a required field is missing, set Notion status to manual_review and post to a private review queue in Slack with an action link to the Notion record.
- For high-value contracts use a separate escalation path that pings senior legal or finance and marks the Notion record as high priority.
- Auditing, retries, and error handling
- Save the raw OpenAI response and full OCR output in Drive and add their IDs to the Notion record for auditability.
- Use Make.com's retry/backoff settings for transient API errors. For permanent failures update Notion with an error note and notify ops.
Real-World Business Scenario
A mid-market SaaS company receiving partner agreements and NDAs implemented this pattern. Incoming contract emails are labeled by Gmail rules. Make.com triages them automatically, creates PandaDoc signature flows for straightforward NDAs, logs every contract in Notion with links to raw OCR output, and notifies legal only for low-confidence or high-value items. Legal's manual triage time dropped from one hour per day to ten minutes, and procurement gained a searchable contract index.
Common Variations
- Replace PandaDoc with DocuSign or Adobe Sign by swapping the e-sign modules and mapping recipients according to that API.
- Add company enrichment (Clearbit-style) to confirm counterparty details before creating the PandaDoc recipient, similar to our Clearbit enrichment patterns.
- Add a clause-risk check: run a second OpenAI prompt to surface risky clauses and only escalate when risk thresholds are exceeded.
Where this fits your automation roadmap
You now have a production-ready architecture to auto-triage contract emails using Make.com, OpenAI, OCR, PandaDoc, Notion, and Slack, including idempotency, audit logging, and human-review routing. If you want this built and tuned across Gmail, PandaDoc, and Notion, Olmec Dynamics implements these automations for real businesses. Learn more about our work at https://olmecdynamics.com.
Related resources: for classification prompt patterns see our Gmail to OpenAI to Zendesk guide: How to Automatically Classify Support Emails Using Gmail, OpenAI, and Zendesk in Make.com. For document generation prior to signature see: How to Generate a PDF from a Google Docs Template Using Make.com and Gmail.