# Auto-save Telegram files to Google Drive by sender

> Every 15 minutes, tuck away every file people send you on Telegram into a tidy Google Drive folder named after who sent it.

- Workflow type: code
- Services: Telegram Secretary Bot, Google Drive
- Categories: Personal Productivity, Operations
- Published: 2026-07-11

## What it does

- Watches your personal Telegram for new messages with attachments (documents, photos, videos, audio notes, voice memos).
- Saves each file into Google Drive under a top-level Telegram Inbox folder, in a subfolder named after the sender.
- Preserves the original filename and stamps it with a timestamp so nothing ever overwrites an older copy.
- Replies in the same chat with a quick got it, saved so the sender knows the file made it through.

## What you'll need

- A Telegram account with the Secretary Bot connected (see our Telegram Secretary setup guide).
- A Google account you use with Google Drive, connected with permission to create folders and upload files.
- A little bit of free Drive space to hold whatever people send you.

## Prompt

Build me a deterministic code workflow that archives every file someone sends me on Telegram into a Google Drive folder organized by sender. This is a fixed pipeline, not an agent making decisions.

Trigger: cron, every 15 minutes.

Steps, in order:

1. Call telegram-secretary Receive Updates to pull the newest updates. Persist the highest update_id so the next run advances the offset and does not reprocess anything.

2. Keep only business_message updates whose message contains an attachment: document, photo, video, audio, or voice. Skip stickers, plain text, and edits.

3. For each attachment on each qualifying message, call telegram-secretary Get File Download Link with the file_id to resolve a downloadable URL. For photos, use the largest size variant.

4. Ensure a root Telegram Inbox folder exists at the top of my Drive. Then, for each sender, ensure a subfolder exists under Telegram Inbox named after the sender's display name (first_name plus last_name, falling back to username, falling back to their user id). Use google-drive Create Folder when a folder is missing. Cache folder ids within the run so we do not create duplicates.

5. Download the file from the resolved URL and upload it into the sender's folder. Use google-drive Upload File (Multipart) for files under 5MB and google-drive Upload File (Resumable) for anything 5MB or larger. Preserve the original filename when Telegram gives us one; fall back to a sensible default per media type (photo.jpg, video.mp4, voice.ogg, audio.mp3). Append an ISO timestamp before the extension so repeated filenames never collide.

6. After a successful upload, call telegram-secretary Send Message as User to reply in the same chat with the text got it, saved. Use the business_connection_id from the incoming update so the reply is sent as the account owner, not as the bot.

Notes for the implementation: every action above maps to a documented operation, so the whole thing is a fixed pipeline of known nodes with structured inputs. If a message has multiple attachments (media group), upload each one and only send a single got it, saved reply per message. If any single attachment upload fails, log it and continue with the rest so one bad file does not block the batch.

## How to customize

- Change how often it runs. Every 15 minutes is a good default, but you can move it up to hourly or down to every few minutes.
- Point it at a different root folder in Drive, or nest it inside a shared drive your team already uses.
- Skip certain attachment types, for example ignore voice notes if you only care about documents and photos.
- Turn off the auto-reply, or change the wording of the confirmation message.

## FAQ

### Does this work on my personal Telegram, or only a bot channel?

Personal. The Telegram Secretary Bot connects to your own Telegram account with your permission, so this captures files people send directly to you, not just messages posted to a bot-owned channel.

### What kinds of files does it save?

Anything sent as a document, photo, video, audio track, or voice note. Stickers and plain text messages are ignored.

### What happens if the same person sends me two files with the same name?

Both are kept. Each upload has a timestamp appended to the filename, so a second file never overwrites the first.

### Where do the folders end up in my Drive?

Under a single top-level folder called Telegram Inbox, with one subfolder per sender using their display name. You can move or rename that root folder any time.

### Will senders know their file was archived?

They see a short got it, saved reply in the same chat. You can change the wording or turn that reply off entirely.

Use this prompt in General Input: https://www.generalinput.com/prompts/auto-save-telegram-files-to-google-drive-by-sender