# TelegramBackup

> Python script that archives chats, channels and groups to SQLite with media, reactions and replies, and renders them as browsable HTML.

Source: https://osinttools.io/tools/telegrambackup/ (Markdown view of an OSINTtools.io page; append `.md` to any page URL for this format).

- **Inputs:** Username, URL
- **Category:** Data capturing
- **Pricing:** Free, open source
- **Footprint:** passive (does not contact the target)
- **Account required:** yes, for full results
- **API:** no public API
- **Platforms:** Python CLI
- **Website:** https://github.com/N4rr34n6/TelegramBackup
- **GitHub:** N4rr34n6/TelegramBackup, 71 stars · HTML · AGPL-3.0 · last commit 2025-04-14 · dormant (no commit on the default branch in 18 months)
- **Listed:** Dec 3
- **Last verified by an editor:** Dec 3, 2026

## What it does

TelegramBackup logs in with your account through Telethon, lists every chat, channel and group it can see along with your contacts (both saved to CSV), and backs up the ones you pick. Messages, buttons, replies and reactions go into a SQLite database, media into a folder per chat, and an HTML page shows the result grouped by date, with reply previews, forwarded-from sources and inline media playback.

The database can be queried directly, and later runs add only messages newer than the last backup, which makes it practical for keeping a structured, searchable copy of channels under investigation. The author frames it for personal backups and asks that it be used only on data you are allowed to process.

Footprint is passive: it reads its own index or third-party records and does not contact the target. An account is needed for full results. There is no public API.

## Features

- Backs up one chat or all of them
- SQLite database of messages, replies, reactions and buttons
- Media saved per chat
- Interactive HTML export
- Incremental updates
- Contact and chat lists exported to CSV

## Pros

- Structured database suited to custom queries
- Keeps forwarded-from information and reactions
- Handles Telegram flood limits

## Cons

- Needs a Telegram api_id and api_hash edited into the script and a logged-in account (use a research account)
- Interactive menu only, no command-line flags
- Last code change in April 2025

## When to use it

- Use it when you want a channel's history as a SQLite database you can query alongside an HTML copy.
- Use it when you need to keep forwarded-from sources and reactions with each archived message.

## Quick start

Run from source (set api_id and api_hash in telegram_backup.py first):

```
git clone https://github.com/N4rr34n6/TelegramBackup.git
cd TelegramBackup
pip install -r requirements.txt
python telegram_backup.py
```

## Alternatives

- [tdl](https://osinttools.io/tools/tdl/): Go command-line toolkit that downloads files from Telegram chats, including protected ones, and exports messages and members to JSON. (Open source · URL, Username · passive · 8,347 GitHub stars)
- [Telegram Media Downloader](https://osinttools.io/tools/telegram-media-downloader/): Python script that downloads every photo, video, voice note and document from chats or channels you belong to, picking up where it stopped. (Open source · Username, URL · passive · 2,769 GitHub stars)
- [tg-archive](https://osinttools.io/tools/tg-archive/): Syncs a Telegram group's messages and media into SQLite and builds a static, browsable website archive of the chat. (Open source · Username, URL · passive · 1,176 GitHub stars)
- [Telegram Archive](https://osinttools.io/tools/telegram-archive/): Self-hosted, scheduled backup of your Telegram account that keeps edits and deleted messages, with a searchable local web viewer. (Open source · Username, URL · passive · 263 GitHub stars)
- [TgWitness](https://osinttools.io/tools/tgwitness/): Self-hosted Telegram archiver that keeps observed edits and deletions and exports signed, timestamped HTML, JSON and PDF records. (Open source · Username, URL · passive · 246 GitHub stars)
- [ta (Telegram Archive)](https://osinttools.io/tools/ta-telegram-archive/): Go command-line and terminal app that backs up chats, groups and channels to Desktop-style JSON or offline HTML with media. (Open source · Username, URL · passive · 78 GitHub stars)

All alternatives to TelegramBackup in one table: https://osinttools.io/tools/telegrambackup/alternatives/

## Change history

- 2026-12-03: Listed in the directory.

Feed of changes to TelegramBackup: https://osinttools.io/tools/changes/feed.xml?tool=telegrambackup

---

Listings on OSINTtools.io are reviewed by editors and re-verified on a schedule; check pricing and availability on the vendor's site before relying on them, and use OSINT tools only with a lawful basis.
Site index for agents: https://osinttools.io/llms.txt · Full catalog: https://osinttools.io/llms-full.txt · MCP server (Streamable HTTP, no auth): https://osinttools.io/mcp/
