Skip to content

Every 10 minutes

File email attachments in Drive and get a summary on Telegram

PDFs and images you receive by email are saved in Drive, and you get a short summary with the link on Telegram.

Runs
Every 10 minutes
Apps
Google Drive, Telegram
AI
Yes, uses the built-in AI allowance
Access
Drive write; Telegram bot token

Send this to your assistant

Create a ClickRuntime automation: when an email with a PDF or image arrives, save the file to Drive, summarise it and send me the summary and link on Telegram.

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 property manager receives contracts, inspection reports and photos from tenants and contractors by email all day. Reading each attachment at a desk is not realistic, so documents wait until the evening and urgent ones are spotted late.

This automation saves every PDF or image attachment to a Drive folder and sends you a short summary on Telegram with the link. You know what arrived and whether it needs attention without opening your inbox.

What you get out of it

  • Know what a document says before you open it

    A two-line summary tells you whether an attachment is routine or urgent, so you can decide on the spot.

  • Attachments filed as they arrive

    Every file is stored in one Drive folder, so you are not searching old emails to find last month's report.

  • Updates reach you on the move

    Telegram messages are easy to read between site visits, where a full inbox is not.

  • Each attachment handled once

    Attachments are saved and summarised a single time, so your chat and folder stay free of duplicates.

How it works

What happens, step by step

  1. Every few minutes ClickRuntime checks your Gmail for new emails with PDF or image attachments.

  2. Emails it has already handled are skipped.

  3. Each attachment is saved in your chosen Drive folder.

  4. AI writes a short summary, and you get it on Telegram with a link to the file.

Before it runs live

  • Connect Google Drive
  • Connect Telegram

What you get

RunsEvery 10 minutes
File email attachments in Drive and get a summary on Telegramtoday, 9:00Succeeded
Telegram · Documents📎 inspection-12-harbour-rd.pdf · Annual gas safety check from Acme Heating, passed, next due Oct 2027.

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 Google Drive and Telegram 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.
email_attachments_analysed_saved_to_drive_summary_on_telegram.pyexample
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from googleapiclient.http import MediaInMemoryUpload
from clickruntime import on_trigger, credentials, http, ai, state, report_fetched
FOLDER_ID, CHAT_ID = "your-drive-folder-id", "your-telegram-chat-id"

@on_trigger
def run(event):
    creds = Credentials(credentials.connection("google", "work"))
    gmail = build("gmail", "v1", credentials=creds, cache_discovery=False)
    seen = set(state.get("seen") or [])
    msgs = [m for m in gmail.users().messages().list(userId="me", q="has:attachment (filename:pdf OR filename:jpg OR filename:png) newer_than:1d")
            .execute().get("messages", []) if m["id"] not in seen]
    report_fetched(len(msgs))
    if not msgs:
        return {"files": 0}
    drive, token = build("drive", "v3", credentials=creds, cache_discovery=False), credentials.secret("TELEGRAM_BOT_TOKEN")
    for m in msgs:
        msg = gmail.users().messages().get(userId="me", id=m["id"]).execute()
        for p in [p for p in msg["payload"].get("parts", []) if p.get("filename")]:
            data = gmail.users().messages().attachments().get(userId="me", messageId=m["id"], id=p["body"]["attachmentId"]).execute()["data"]
            f = drive.files().create(body={"name": p["filename"], "parents": [FOLDER_ID]}, fields="id,webViewLink",
                                     media_body=MediaInMemoryUpload(base64.urlsafe_b64decode(data), mimetype=p["mimeType"])).execute()
            summary = ai.generate(f"Summarise in two lines what this attachment is, given the email:\n{msg['snippet']}\nFile: {p['filename']}",
                                  max_output_tokens=120).text
            http.post(f"https://api.telegram.org/bot{token}/sendMessage", json={"chat_id": CHAT_ID, "text": f"📎 {p['filename']}\n{summary}\n{f['webViewLink']}"})
        seen.add(m["id"])
    state.set("seen", list(seen)[-1000:])
    return {"emails": len(msgs)}

FAQ

Common questions

Which attachments are included?
PDFs and common image formats such as JPG and PNG. Calendar invites, signatures and tiny inline images are skipped.
Where are the files saved?
In a Drive folder you choose, with the original file name. You can also have them sorted into subfolders by sender.
How long is the summary?
Two or three short lines covering what the document is, who it is from and any date or amount that stands out.
What permissions does it need?
Drive write; Telegram bot token. 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 “File email attachments in Drive and get a summary on Telegram” from your assistant

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