TelegramArchive

command module
v0.0.0-...-bd243ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 1 Imported by: 0

README

ta (Telegram Archive)

A rosy-cheeked backup gopher hugging a ta archive box in a little paper-plane hat

ta backs up Telegram chats, groups and channels as JSON or offline HTML. It downloads media, keeps checkpoints and adds new messages on later runs. Back up and download files from restricted channels your account can access. Inspired by tdl, ta uses its transfer and session components.

Supported features

  • Archive chats, groups and public/private channels.
  • Restricted/protected-content channel backups and downloads.
  • Desktop-style JSON and offline HTML with local media.
  • File-type, date and size filters.
  • Parallel downloads with progress, resume and recovery.
  • Archive and cron job results with message totals and media counts by type.
  • Account data and Saved Messages backups.
  • Incremental sync, refresh and cron schedules.
  • Multiple saved Telegram accounts with separate cron backups.
  • Offline rendering, statistics, uploads and forwarding.
  • Interactive Bubble Tea workspace with chat/account browsers, action buttons and live task results.

Installation

With Go 1.26 or newer installed, run:

go install github.com/mo1ein/TelegramArchive/cmd/ta@latest
ta

Run the same go install command to update ta. Go installs the binary into GOBIN, or GOPATH/bin when GOBIN is unset. If your shell cannot find ta, add that directory to your PATH. For the default macOS/Linux setup:

export PATH="$(go env GOPATH)/bin:$PATH"

Add the export line to ~/.zshrc or ~/.bashrc to keep it in new terminals. On Windows, add the Go binary directory to your user Path.

To install a local checkout, including unpublished changes, run go install ./cmd/ta or make install from the repository root. make build remains available for a local bin/ta binary.

Quick start

Run ta or ta tui in a terminal to open the interactive workspace. Choose a quick-start workflow or search every command with /. Edit options, press Ctrl+R to review, then Enter to run. Login prompts and transfer progress stay inside the workspace. Browse chats, switch accounts and manage schedules from selectable lists with action buttons. Workspace guide and shortcuts.

The commands below also work directly:

ta login -T qr                  # use -T code for phone/code login
ta archive --all --types channels --media all --format both

On macOS, you can also import the login from your existing native Telegram app, including the website download. See macOS login setup for Full Disk Access, local passcodes, verification and import commands.

This exports every joined channel, including private channels and archived dialogs. Files go to ./data. Open data/export_results.html to browse them. Resume is on by default. Rerun the same command to continue or fetch new messages.

Common commands

# A private group by name; usernames, URLs and IDs also work.
ta archive --chat "Book Club" --media all

# PDF/ZIP files from joined channels, with date and size limits.
ta archive --all --types channels --media documents --extensions pdf,zip \
  --since 2026-01-01 --until 2026-02-01 --min-file-size 1024 \
  --max-file-size 104857600 --format html

# Account data, including Saved Messages, in a separate account directory.
ta account --include all --media all --format both

# Sync all chats and account data once.
ta sync --everything --format both

# Back up now, then let system cron sync this channel every six hours.
ta cron add my-channel --chat "channel_username" --every 6h \
  --media all --format both --output ./data --run-now

Use --output to choose a destination. Keep the same destination and filters when resuming. Use a separate output root for each Telegram account. Cron requires a working cron service and the crontab command.

See Cron jobs for different accounts for separate saved logins and schedules.

HTML preview

Fictional meme demo in Telegram Desktop's export style. Profile photos added for illustration. Click a preview to enlarge it.

Fictional meme chat export with photos, replies and a pollFictional account export with Saved Messages and account sections
Chat exportAccount export

Documentation

Guide Covers
Interactive workspace Search, guided forms, presets, advanced options, review and keyboard shortcuts
Archiving Chat selection, media/date/size filters, custom names, resume, refresh, progress, JSON/HTML, offline rendering and statistics
Backups Account sections, Saved Messages, one-time sync, recurring sync, cron jobs and logs
Accounts and settings Login, multiple terminals, proxies, storage, environment settings, transfer commands and build checks
macOS login setup Native website client, data paths, Full Disk Access, passcodes, import and troubleshooting
Transfers and tools Downloads, uploads, forwarding, chat tools, templates, session tools, extensions and shell completion
Desktop export coverage Supported formats, fields and API limits
Contributing Development workflow and privacy checks

Run ta --help or ta <command> --help for command options.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
ta command
core
internal
archive
Package archive writes portable Telegram Desktop-style chat archives.
Package archive writes portable Telegram Desktop-style chat archives.
cron
Package cron manages ta's entries in the current user's crontab.
Package cron manages ta's entries in the current user's crontab.
macsession
Package macsession reads native Telegram for macOS sessions without changing the source application's files.
Package macsession reads native Telegram for macOS sessions without changing the source application's files.
schedule
Package schedule runs one backup job at a time on a fixed interval.
Package schedule runs one backup job at a time on a fixed interval.
taskui
Package taskui carries bounded progress frames from isolated task workers.
Package taskui carries bounded progress frames from isolated task workers.
telegram
Package telegram adapts gotd messages and pooled transfers to the archive engine.
Package telegram adapts gotd messages and pooled transfers to the archive engine.
tui
Package tui provides the interactive command workspace for ta.
Package tui provides the interactive command workspace for ta.
pkg
key
kv
tdesktop
Package tdesktop exports functions from github.com/gotd/td/session/tdesktop package
Package tdesktop exports functions from github.com/gotd/td/session/tdesktop package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL