06291f0a6e33808ba96ecc6d128d9cbc8b0de754
- Author
- zertrin <zertrin@gmail.com>
- Committer
- zertrin <zertrin@gmail.com>
- Date
Message
Merge branch 'telegram-notifications' of git://github.com/GerardRibas/duplicity-backup.sh into GerardRibas-telegram-notifications
Diff
1diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
2index 0a0dc992fd29f4e8fb627d672c7cc5fba0de0c0b..0391982c7aafed1b97af830ed5016f71b20192e0 100644
3--- a/duplicity-backup.conf.example
4+++ b/duplicity-backup.conf.example
5@@ -439,6 +439,10 @@ IFTTT_MAKER_EVENT="duplicity" # name the event to trigger at IFTTT Maker Channel
6 IFTTT_HOOK_URL="https://maker.ifttt.com/trigger/$IFTTT_MAKER_EVENT/with/key/$IFTTT_KEY" # ONLY change this if IFTTT changes it
7 IFTTT_VALUE2="" # general purpose value to pass to your maker channel (optional)
8
9+# Provider: Telegram
10+TELEGRAM_CHATID="" #Generate a Telegram bot following guide: https://core.telegram.org/bots#3-how-do-i-create-a-bot
11+TELEGRAM_KEY=""
12+
13 # ------------------------------------------------------------------------------
14 # TROUBLESHOOTING
15 # ------------------------------------------------------------------------------
16diff --git a/duplicity-backup.sh b/duplicity-backup.sh
17index a99ab06c4fa2d807983ff85eb52dba59bccee9c4..8b2f0f109fbc2576f9d5c2fb834400dbee48672d 100755
18--- a/duplicity-backup.sh
19+++ b/duplicity-backup.sh
20@@ -558,6 +558,9 @@ send_notification()
21 -F "message=${NOTIFICATION_CONTENT}" \
22 https://api.pushover.net/1/messages
23 echo -e "Pushover notification sent"
24+ elif [ "${NOTIFICATION_SERVICE}" = "telegram" ]; then
25+ curl -s --max-time 10 -d "chat_id=$TELEGRAM_CHATID&disable_web_page_preview=1&text=$NOTIFICATION_CONTENT" "https://api.telegram.org/bot$TELEGRAM_KEY/sendMessage" >/dev/null
26+ echo -e "Telegram notification sent"
27 fi
28 fi
29 }