c9bd2a49f29beec7a419ee9ee5812cd79f110f8a

Author
Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
Committer
Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
Date

Message

Add IFTTT notification service

Add the ability to trigger a custom event on the Maker channel provided
by IFTTT service. With this trigger one can program actions on another
channels. Examples:

-Log backup notification to a google spreadsheet;
-Receive notification on devices with IFTTT application installed;
-Send e-mails
-Log to evernote
-Turn a Philips Hue light green for good backup or red on errors

IFTTT Maker channel accepts three values (named value1, value2, value3)
as part of the trigger. This implementation sends the content of
NOTIFICATION_CONTENT as "value1" parameter and let "value2" be defined at
configuration file. At this time "value3" is not used.

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index ff262af03e5bea5f6a4a8b5c44d8380c3c18cbd9..3f1aec898b476f70f66b16c4b9503e397685aad0 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -416,6 +416,9 @@ send_notification()
 6     if [ "${NOTIFICATION_SERVICE}" = "slack" ]; then
 7       curl -X POST -H 'Content-type: application/json' --data "{\"text\": \"${NOTIFICATION_CONTENT}\", \"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_USERNAME}\", \"icon_emoji\": \":${SLACK_EMOJI}:\"}" "${SLACK_HOOK_URL}"
 8       echo -e "Slack notification sent to channel ${SLACK_CHANNEL}" >> "${LOGFILE}"
 9+    elif [ "${NOTIFICATION_SERVICE}" = "ifttt" ]; then
10+    	curl -X POST -H 'Content-type: application/json' --data "{\"value1\": \"${NOTIFICATION_CONTENT}\", \"value2\": \"${IFTTT_VALUE2}\"}" "${IFTTT_HOOK_URL}"
11+      echo -e "IFTTT notification sent to Maker channel event ${IFTTT_EVENT}" >> "${LOGFILE}"	
12     elif [ "${NOTIFICATION_SERVICE}" = "pushover" ]; then
13       curl -s \
14       -F "token=${PUSHOVER_TOKEN}" \