Skip to content

Every 15 minutes

Summarise PDF attachments arriving in Gmail or Outlook

When a PDF arrives in either your Gmail or your Outlook, you get an email with a short summary of what it says.

Runs
Every 15 minutes
Apps
Gmail, Outlook
AI
Yes, uses the built-in AI allowance
Access
gmail.readonly; Mail.Read

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, check my Gmail and my Outlook for new emails with PDF attachments. Summarise each PDF with AI in five bullet points and email me the summaries with the sender and subject.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A lawyer receives contracts, reports and letters as PDFs in two mailboxes, one for the firm and one for their own practice. Opening every attachment to see whether it needs attention today takes a large part of the day.

A short summary of each PDF, wherever it arrived, shows at a glance which ones need reading now and which can wait.

What you get out of it

  • Know what is in a PDF before opening it

    Five bullet points show what each document is and what it asks for.

  • Both mailboxes covered

    Attachments from Gmail and Outlook are summarised in the same way.

  • Prioritise your reading

    Urgent documents stand out from routine ones.

  • Summaries in one place

    All summaries come to one email address, so nothing is missed in the other inbox.

How it works

What happens, step by step

  1. Every 15 minutes, ClickRuntime checks your Gmail and your Outlook for new emails with PDF attachments.

  2. It reads the text from each PDF.

  3. AI writes a five-point summary of each document.

  4. You get one email with the summaries, each with its sender and subject.

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 Outlook

What you get

RunsEvery 15 minutes
Summarise PDF attachments arriving in Gmail or Outlooktoday, 9:00Succeeded
Email · PDFs summarisedOutlook: Acme supply agreement v3 • 24-month term from 1 January • Price review each April, capped at 4% • Signature needed by 31 October

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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 Outlook steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
summarise_pdfs_arriving_in_either_inbox.pyexample
import base64
import io
from pypdf import PdfReader
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, report_fetched, http, credentials, ai, state, notify

api = lambda name, version: build(name, version, credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)

def graph(method, path, **kw):
    r = http.request(method, "https://graph.microsoft.com/v1.0" + path, headers={"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}, **kw)
    return r.raise_for_status() or (r.json() if r.content else None)

pdf_text = lambda b64: " ".join(p.extract_text() or "" for p in PdfReader(io.BytesIO(base64.b64decode(b64))).pages)[:12000]

@on_trigger
def run(event):
    gmail, seen, since = api("gmail", "v1").users().messages(), set(state.get("seen") or []), state.get("since") or "2026-01-01T00:00:00Z"
    pdfs = []
    for ref in gmail.list(userId="me", q="has:attachment filename:pdf newer_than:1d").execute().get("messages", []):
        if ref["id"] in seen:
            continue
        m = gmail.get(userId="me", id=ref["id"]).execute()
        subject = next(h["value"] for h in m["payload"]["headers"] if h["name"] == "Subject")
        for p in m["payload"].get("parts", []):
            if p.get("filename", "").lower().endswith(".pdf"):
                data = gmail.attachments().get(userId="me", messageId=ref["id"], id=p["body"]["attachmentId"]).execute()["data"]
                pdfs.append((f"Gmail: {subject}", base64.b64encode(base64.urlsafe_b64decode(data)).decode()))
        seen.add(ref["id"])
    out = graph("GET", "/me/messages", params={"$filter": f"hasAttachments eq true and receivedDateTime gt {since}", "$select": "id,subject,receivedDateTime"})["value"]
    for m in out:
        pdfs += [(f"Outlook: {m['subject']}", a["contentBytes"]) for a in graph("GET", f"/me/messages/{m['id']}/attachments")["value"] if a.get("contentType") == "application/pdf"]
    report_fetched(len(pdfs))
    if not pdfs:
        return {"summary": "No new PDFs"}
    parts = [f"{label}\n" + ai.generate(pdf_text(b64), system="Summarise this document in 5 bullet points, noting any deadline.", max_output_tokens=300).text for label, b64 in pdfs]
    notify.email_me(f"{len(pdfs)} PDFs summarised", "\n\n".join(parts))
    state.set("seen", sorted(seen)[-3000:])
    state.set("since", max([since] + [m["receivedDateTime"] for m in out]))
    return {"pdfs": len(pdfs)}

FAQ

Common questions

How long can the PDFs be?
Long documents are trimmed to the first several thousand words, which covers the key points of most contracts and reports.
Does it work on scanned documents?
Only if the PDF contains text. Scanned images without text recognition can't be read.
Are the documents stored anywhere?
No. Each PDF is read during the run, summarised, and not kept.
What permissions does it need?
gmail.readonly; Mail.Read. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Summarise PDF attachments arriving in Gmail or Outlook” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.