Archive
Telegram Archive
Your Telegram history, on your own disk.
Telegram Archive backs up one or more Telegram accounts to a machine you host. It 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, and it never talks to Telegram.
Features
- Saves new messages, media, edits and reactions as they happen, and runs a daily pass that fetches only what is new.
- Keeps every edit with its earlier text, and every deleted message with its text and media.
- Saves each photo, video or document once, however many chats share it.
- A viewer that reads like Telegram, with folders, forum topics, reactions and search across 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.
- Read-only containers with every capability dropped, for amd64 and arm64, or a plain pip install.
Run it yourself
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 -dReplace the sample values with your own. 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.