Back up your projects to Telegram with a fast, reliable workflow built around modern best practices.
Large archives are split automatically, failed uploads are retried, and every Telegram API response is validated.
Each backup is saved locally as a compact, timestamped .tar.zst archive, keeping a complete copy under your control.
- Fast multithreaded Zstandard compression
- Timestamped backup filenames in UTC
- Automatic splitting into 45 MiB parts
- Sequential upload of all backup parts
- Part numbering in Telegram captions
- Automatic retries for network and API errors
- Telegram API response validation
- Configurable connection and upload timeouts
- Local preservation of the complete archive
- Automatic removal of temporary split files
- Secure handling of the Telegram bot token through environment variables
- Strict Bash error handling
- Safe handling of paths containing spaces
- Automatic dependency and directory validation
- Protection against placing the backup directory inside the source directory
- Restrictive permissions for generated backup files
- Healthchecks.io monitoring and heartbeat reporting (soon)
- Structured logging with configurable log levels (soon)
- Client-side archive encryption with
age(planned) - SHA-256 integrity verification (planned)
- Automatic backup retention and local cleanup (planned)
- Exclusion rules for caches, logs, and temporary files (planned)
- PostgreSQL and MariaDB backup support (planned)
- Docker volume backup support (planned)
- Multi-project configuration profiles (planned)
- Restore and verification helper (planned)
- Success and failure notifications (planned)
- Dry-run mode (planned)
install -m 700 telegram-backup.sh /usr/local/sbin/telegram-backupCreate a bot using @BotFather and save the generated bot token. Send at least one message to the bot, then obtain the destination chat ID.
install -m 600 /dev/null /etc/telegram-backup.env
nano /etc/telegram-backup.envAdd the following configuration:
BACKUP_DIRECTORY="/telegram/backups"
PROJECT_DIRECTORY="/telegram/project"
TELEGRAM_CHAT_ID="123456789"
TELEGRAM_BOT_TOKEN="123456789:Your_Bot_Token"Replace the example values with your actual directories and Telegram credentials. The backup directory must not be located inside the project directory.
set -a
source /etc/telegram-backup.env
set +a
/usr/local/sbin/telegram-backupA successful execution returns:
Backup completed successfully: /telegram/backups/project_2026-08-25T01-30-00Z.tar.zst
The complete local backup is stored as:
project_2026-08-25T01-30-00Z.tar.zst
Backups larger than 45 MiB are uploaded to Telegram as numbered parts:
project_2026-08-25T01-30-00Z.tar.zst.part-0001
project_2026-08-25T01-30-00Z.tar.zst.part-0002
project_2026-08-25T01-30-00Z.tar.zst.part-0003
Temporary parts are deleted from the server after the upload.
The complete .tar.zst archive remains in the configured backup directory.
Extract a complete archive:
tar --zstd -xf project_2026-08-25T01-30-00Z.tar.zstIf the backup was downloaded from Telegram as multiple parts, combine them first:
cat project_2026-08-25T01-30-00Z.tar.zst.part-* > project_2026-08-25T01-30-00Z.tar.zst
tar --zstd -xf project_2026-08-25T01-30-00Z.tar.zstExample cron job for a daily backup at 03:30:
30 3 * * * set -a; . /etc/telegram-backup.env; set +a; /usr/local/sbin/telegram-backup >> /var/log/telegram-backup.log 2>&1