Once a contract is fully executed, someone has to download the signed PDF, rename it, navigate to the right folder, and file it, then confirm the filing on the ticket or email thread. Contracts arrive from multiple sources (Jira tickets, DocuSign emails, forwarded PDFs) and the manual work is identical for each.
For teams processing dozens of contracts weekly, this leads to unfiled documents, inconsistent naming, duplicate folders, and no audit trail.
Two Google Apps Scripts share a single filing vault, naming convention, and AI-powered routing engine. No servers required. Everything runs on timed triggers.
Runs every 15 minutes. Scans open legal tickets, identifies executed PDFs by filename keywords or comment triggers, OCRs the document, extracts metadata via AI (with regex fallback), renames and routes the file, and posts a confirmation comment.
Runs every 15-60 minutes. Monitors Gmail for DocuSign completion emails (sender-whitelisted) and PDFs forwarded to a dedicated filing inbox. Sends the raw PDF to an AI multimodal API for visual analysis, files it, and replies on the original thread with a Drive link.
Map top-level folders by agreement category (Advertiser, Partner, Vendor, NDA, Referral), with subfolders by region then client. Set a naming convention.
Create an Apps Script with a Jira API token. Configure project key, monitored statuses, and custom field IDs. Track filed attachments per-ticket to prevent duplicates.
Add a Gmail search for DocuSign completion emails filtered by sender whitelist. Label processed threads to avoid re-scanning.
OCR each PDF, send to AI for client name, agreement type, signature date, and region. Include a regex/keyword fallback.
Map agreement types to folders with priority-ordered keywords. Normalize folder names before creating subfolders to prevent near-duplicates.
Post confirmation comments with filename, path, Drive link, and confidence warnings. Set timed triggers with retry logic.
Eliminated repetitive contract filing work while maintaining permission safeguards. Contracts from both Jira and DocuSign emails are automatically classified, renamed, filed to the correct Drive folder, and confirmed back to the source. Filing errors dropped to near zero. The team reclaimed significant time for higher-value legal work.