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.

pip install.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.2.1 and drumsergio/telegram-archive-viewer:9.2.1
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.
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.
GPL-3.0-or-later. Built on Telethon.
Content type
Image
Digest
sha256:404a4869f…
Size
238.6 MB
Last updated
about 2 hours ago
docker pull drumsergio/telegram-archive