telegram-archive

telegram-archive

Docker app from geiserx's Repository

Overview

Automated Telegram backup service that periodically archives messages and media from your chats, groups, and channels. Uses Telethon for scheduled exports with optional real-time message listening. Supports SQLite or PostgreSQL, media deduplication, and configurable retention.

This is the backup container. For browsing archived messages, install the Telegram Archive Viewer container separately.

Requires Telegram API credentials from https://my.telegram.org

More info: https://github.com/GeiserX/Telegram-Archive

Telegram Archive

Release Tests License Docker Pulls Coverage

Telegram Archive backs up one or more Telegram accounts to a machine you host. It runs in Docker or from pip, and saves messages, media, edits and deletions to SQLite or PostgreSQL on your own disk. A web viewer, which never talks to Telegram, lets you read and search what it saved.

Telegram Desktop's own export is a one-off file with no earlier versions and no deleted messages; this runs on a schedule, keeps earlier versions and deleted messages, and can import that export too.

A group chat in the viewer, with a pinned message, a four-photo album, replies and reactions

Features

  • Saves new messages, their media, edits and reactions the moment they happen, and runs a daily full pass that fetches only what is new to fill in anything the live connection missed.
  • Keeps every edit with its earlier text, and keeps every deleted message, marked as deleted, with its text and media.
  • Saves photos, videos, voice notes, stickers, documents and link previews once each, however many chats share them, and skips files over a size you set.
  • Reads like Telegram: chats, forum topics, folders, archived chats, reactions, pinned messages, polls and shared media, with search across every chat.
  • Shows what Telegram no longer does: a What changed feed of deletions, edits and new transcripts, and the earlier profile photos of every chat.
  • Backs up several accounts into one archive, and imports Telegram Desktop exports.
  • Turns voice messages into searchable text through a transcription server you run or rent.
  • Gives other people a login to chosen chats or a share link that opens one chat, and sends browser notifications for new messages.
  • Twelve themes, including one that follows the system light or dark setting, on a viewer that works on a phone.
  • Stays yours: SQLite or PostgreSQL on your disk, read-only containers with every capability dropped, for amd64 and arm64, or a plain pip install.

Quick start

You need Docker Compose, and an api_id and api_hash for your account from my.telegram.org/apps.

curl -fsSLO https://raw.githubusercontent.com/GeiserX/Telegram-Archive/main/docker-compose.yml
cat > .env <<'EOF'
TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=0123456789abcdef0123456789abcdef
TELEGRAM_PHONE=+15551234567
VIEWER_USERNAME=admin
VIEWER_PASSWORD=choose-a-long-password
VIEWER_TIMEZONE=Europe/London
EOF
mkdir -p data && sudo chown -R 1000:1000 data
docker compose run --rm telegram-backup python -m telegram_archive auth
docker compose up -d   # drumsergio/telegram-archive:9.3.3 and drumsergio/telegram-archive-viewer:9.3.3

auth asks for the code Telegram sends you, and for your two-step password if you have one. Then open http://127.0.0.1:8000, sign in with the viewer username and password, and watch the first backup fill the chat list. Run with Docker has every step, with the Podman and Colima notes, and Install from PyPI runs the same thing from pip install telegram-archive.

Documentation

The full documentation is at geiserx.github.io/Telegram-Archive.

Release notes are in the changelog. Open an issue for bugs and questions; the troubleshooting page says what to include. Report security problems through the security policy, never in a public issue.

License

GPL-3.0-or-later. Built on Telethon.

Requirements

Telegram API credentials from my.telegram.org

Download Statistics

53,720
Total Downloads
15,123
This Month
9,812
Avg / Month

Total Downloads Over Time

Loading chart...

Related apps

Explore more like this

Explore all

Details

Repository
drumsergio/telegram-archive:latest
Last Updated2026-09-26
First Seen2026-04-06

Runtime arguments

Network
bridge
Privileged
false

Template configuration

Session DataPathrw

Telethon session storage

Target
/data/session
Default
/mnt/user/appdata/telegram-archive/session
BackupsPathrw

Backup data and media files

Target
/data/backups
Default
/mnt/user/appdata/telegram-archive/backups
API IDVariable

Telegram API ID from my.telegram.org

Target
TELEGRAM_API_ID
API HashVariable

Telegram API hash from my.telegram.org

Target
TELEGRAM_API_HASH
Phone NumberVariable

Phone number with country code (e.g. +1234567890)

Target
TELEGRAM_PHONE
ScheduleVariable

Cron schedule for backups (default: every 6 hours)

Target
SCHEDULE
Default
0 */6 * * *
Download MediaVariable

Download media files during backup

Target
DOWNLOAD_MEDIA
Default
true
Max Media Size (MB)Variable

Maximum media file size to download in MB

Target
MAX_MEDIA_SIZE_MB
Default
100
Enable ListenerVariable

Enable real-time message listening between scheduled backups

Target
ENABLE_LISTENER
Default
false
Chat IDsVariable

Comma-separated chat IDs to back up (empty = all chats)

Target
CHAT_IDS
Chat TypesVariable

Types of chats to back up

Target
CHAT_TYPES
Default
private,groups,channels