[Tool] Rich Telegram notification script for Duplicati backup jobs

Hi everyone,

I’ve built a small open-source shell script to get rich Telegram notifications from Duplicati backups. Instead of minimal status messages, it uses Duplicati’s --run-script-after / --run-script-before hooks to send HTML-formatted Telegram reports that include:

  • Clear status with icons (success / warning / error)
  • Changed files (added / modified / deleted)
  • Size and duration metrics
  • Optional detailed logs when a backup fails

The script is Docker-friendly (supports env vars and .env files for Bot Token and Chat ID), and it handles CRLF line endings so it works reliably even if you edit it on Windows and run it in a Linux container.

Integration is straightforward: make the script executable and point Duplicati’s --run-script-after (or --run-script-before) option to it.

If you’d like more readable, information-dense Telegram notifications for your Duplicati jobs, you can find the project here:

Feedback, ideas for additional fields, and PRs are very welcome!

Thank you very much for this excellent script that gives a nice overview of the backup.

I would like to see the duration of the process, but when I added the line:

Duration: $(printf %.2d:%.2d:%.2d $Duration)

I only get 00:00:00.

What is the right name of the veriable for duration?

The variable name Duration is correct. The problem was that the sed pattern \w* in the script couldn’t capture the value because it contains : and . (e.g. 00:00:03.3462766). I’ve updated notify_to_telegram.sh to extract Duration using grep -oP instead, and added a ⏱ Duration: $Duration line to the Telegram message.

leave a star if the scripts was useful :slight_smile:

Thank you. This looks promissing.

Your script inspired me to also send this as email with the following lines:

#Send message to Mail with HTML formatting

MESSAGE+="
"

echo “$MESSAGE” | mutt wk@example.com -s “$DUPLICATI__PARSED_RESULT for $DUPLICATI__backup_name” -e “set content_type=text/html”> /dev/null

Perhaps someone finds this usefull too.

cool! new version is already in github just grab it and leave a star!!