Every 15 minutes
Summarise new contracts in Drive and email the key terms
Every PDF added to your Contracts folder gets a summary document in Drive and an email to you with the key terms.
- Runs
- Every 15 minutes
- Apps
- Gmail, Google Drive
- AI
- Yes, uses the built-in AI allowance
- Access
- Drive read+write; Gmail gmail.send
Send this to your assistant
Create a ClickRuntime automation: when a new PDF appears in my Drive 'Contracts' folder, extract the parties, dates, value and notice period, save a summary document in Drive and email it to me.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An operations manager at a growing agency signs client contracts, supplier agreements and NDAs every week, and they all end up in one Drive folder. When a renewal comes up or a client asks about notice periods, he opens a thirty-page PDF and searches for the clause.
A short summary of each contract, written as soon as it is filed, gives you the parties, dates, value and notice terms at a glance. Small businesses without a legal team use it to keep track of what they have agreed to and when obligations fall due.
What you get out of it
Key terms without reading the whole contract
The summary pulls out parties, start and end dates, value and notice period, which covers most questions people ask about a contract.
Renewal dates do not surprise you
With end dates and notice periods written down the day a contract arrives, it is easy to put renewals in the calendar.
A summary next to every contract
The summary document sits in Drive beside the PDF, so anyone with access to the folder can find it.
You know when a new contract is filed
The email tells you as soon as a colleague adds a contract, so nothing is signed and forgotten.
How it works
What happens, step by step
Every few minutes ClickRuntime checks your Drive Contracts folder for new PDFs.
It skips any file it has already summarised.
AI reads the contract and picks out the parties, dates, value, payment terms and notice period.
A summary document is saved in Drive and you get an email with the key terms and a link.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
- Connect Google Drive
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Gmail and Google Drive steps into one automation
Under the hood
The code that runs this automation
import io
from pypdf import PdfReader
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaIoBaseUpload
from clickruntime import on_trigger, credentials, state, notify, ai, report_fetched
FOLDER_ID = "your-contracts-folder-id"
@on_trigger
def run(event):
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
seen = set(state.get("seen") or [])
files = drive.files().list(q=f"'{FOLDER_ID}' in parents and mimeType='application/pdf' and trashed=false", fields="files(id,name)").execute()["files"]
new = [f for f in files if f["id"] not in seen]
report_fetched(len(new))
if not new:
return {"summary": "Nothing new"}
for f in new:
pdf = drive.files().get_media(fileId=f["id"]).execute()
text = "".join(p.extract_text() or "" for p in PdfReader(io.BytesIO(pdf)).pages)[:20000]
summary = ai.generate(f"Summarise this contract: parties, dates, value, payment terms, notice period, unusual clauses.\n{text}", max_output_tokens=600).text
doc = drive.files().create(body={"name": f"Summary - {f['name']}", "parents": [FOLDER_ID], "mimeType": "application/vnd.google-apps.document"},
media_body=MediaIoBaseUpload(io.BytesIO(summary.encode()), mimetype="text/plain"), fields="webViewLink").execute()
notify.email_me(f"Contract summary: {f['name']}", f"{summary}\n\n{doc['webViewLink']}")
seen.add(f["id"])
state.set("seen", list(seen)[-1000:])
return {"summarised": len(new)}FAQ
Common questions
What details are pulled out?
Is the summary a replacement for reading the contract?
Does it work with scanned contracts?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Save invoice PDFs from Gmail to Drive, named by supplier and amount
Invoice and receipt PDFs in your inbox are saved to Drive as date_supplier_amount files, and the email is labelled as filed.
See how it worksTranscribe emailed audio and save summaries to Drive
Voice notes and recordings sent to your inbox become a transcript and summary in Drive, with the summary emailed to you.
See how it worksFile emailed CVs in Drive with a short candidate review
Every CV sent to your jobs inbox is saved to your Candidates folder and you get an email with a short review against the role.
See how it worksKeep exploring
Set up “Summarise new contracts in Drive and email the key terms” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.