Add Telegram notification
This commit is contained in:
parent
88c73e30f8
commit
4d04257240
|
@ -12,7 +12,8 @@ sitename="" # Title of site "Example Sit
|
|||
slackchannel="" # Slack Channel #example
|
||||
slackuri="" # URI for Slack WebHook "https://hooks.slack.com/services/xxxxx"
|
||||
discorduri="" # URI for Discord WebHook "https://discordapp.com/api/webhooks/xxxxx"
|
||||
|
||||
telegramtoken="" # Telegram bot API Token
|
||||
telegramchatid="" # Telegram Chat ID
|
||||
|
||||
###########################################
|
||||
## Check if we have a public IP
|
||||
|
@ -103,6 +104,12 @@ case "$update" in
|
|||
"content" : "'"$sitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
|
||||
}' $discorduri
|
||||
fi
|
||||
if [[ $telegramtoken != "" ]] && [[ $telegramchatid != "" ]]; then
|
||||
curl -H 'Content-Type: application/json' -X POST \
|
||||
--data-raw '{
|
||||
"chat_id": "'$telegramchatid'", "text": "'"$sitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip').", "disable_notification": true
|
||||
}' https://api.telegram.org/bot$telegramtoken/sendMessage
|
||||
fi
|
||||
exit 1;;
|
||||
*)
|
||||
logger "DDNS Updater: $ip $record_name DDNS updated."
|
||||
|
@ -119,5 +126,11 @@ case "$update" in
|
|||
"content" : "'"$sitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
|
||||
}' $discorduri
|
||||
fi
|
||||
if [[ $telegramtoken != "" ]] && [[ $telegramchatid != "" ]]; then
|
||||
curl -H 'Content-Type: application/json' -X POST \
|
||||
--data-raw '{
|
||||
"chat_id": "'$telegramchatid'", "text": "'"$sitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'", "disable_notification": true
|
||||
}' https://api.telegram.org/bot$telegramtoken/sendMessage
|
||||
fi
|
||||
exit 0;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue