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

Get an api_id and api_hash for your account at my.telegram.org/apps.
Get the files:
git clone https://github.com/GeiserX/Telegram-Archive.git
cd Telegram-Archive
Copy the settings file:
cp .env.example .env
Open .env and set these lines. The three viewer lines start commented out, so remove the # in front of them:
TELEGRAM_API_ID=12345678
TELEGRAM_API_HASH=0123456789abcdef0123456789abcdef
TELEGRAM_PHONE=+15551234567
VIEWER_USERNAME=admin
VIEWER_PASSWORD=choose-a-long-password
VIEWER_TIMEZONE=Europe/London
Create the data directory. Both containers run as user ID 1000, so that user must own the directory:
mkdir -p data && sudo chown -R 1000:1000 data
Log in to Telegram:
docker compose run --rm telegram-backup python -m telegram_archive auth
Telegram sends a login code, and the command asks for it. If the account uses two-step verification, the command also asks for that password. The password is visible as you type, so run this where nobody can see your screen. See Log in to Telegram if the login fails or must run without a terminal.
Start both containers:
docker compose up -d
Open http://127.0.0.1:8000 and sign in with VIEWER_USERNAME and VIEWER_PASSWORD.
The first backup starts right away. Your first backup covers the schedule and what to check next.
The compose file pins both images to this release:
drumsergio/telegram-archive:8.17.0
drumsergio/telegram-archive-viewer:8.17.0
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.
Content type
Image
Digest
sha256:c47cccbad…
Size
236.3 MB
Last updated
14 minutes ago
docker pull drumsergio/telegram-archive