Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ntfy.sh notification provider #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cloudflare-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +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"
ntfyuri="ntfy.sh" # URI for ntfy server. Default is ntfy.sh
ntfytopic="" # Topic for ntfy.sh "https://ntfy.sh/xxxxx"


###########################################
Expand Down Expand Up @@ -103,6 +105,14 @@ case "$update" in
"content" : "'"$sitename"' DDNS Update Failed: '$record_name': '$record_identifier' ('$ip')."
}' $discorduri
fi
if [[ $ntfytopic != "" ]]; then
curl \
-H "Title: $sitename DDNS Update Failed" \
-H "Priority: urgent" \
-H "Tags: warning" \
-d "'$record_name': '$record_identifier' ('$ip')." \
$ntfyuri/$ntfytopic
fi
exit 1;;
*)
logger "DDNS Updater: $ip $record_name DDNS updated."
Expand All @@ -119,5 +129,11 @@ case "$update" in
"content" : "'"$sitename"' Updated: '$record_name''"'"'s'""' new IP Address is '$ip'"
}' $discorduri
fi
if [[ $ntfytopic != "" ]]; then
curl \
-H "Title: $sitename Updated" \
-d $record_name"'s new IP Address is '$ip'" \
$ntfyuri/$ntfytopic
fi
exit 0;;
esac
18 changes: 18 additions & 0 deletions cloudflare-templatev6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ log_header_name="DDNS Updater_v6"
# @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"
# @ntfyuri - URI for ntfy server. Default is ntfy.sh
# @ntfytopic - Topic for Ntfy.sh "https://ntfy.sh/xxxxx"
# -------------------------------------------------- #
sitename=""
slackchannel=""
slackuri=""
discorduri=""
ntfyuri="ntfy.sh"
ntfytopic=""



Expand Down Expand Up @@ -164,6 +168,14 @@ case "$update" in
\"content\": \"$sitename DDNS Update Failed: $record_name: $record_identifier ($ip).\"
}" $discorduri
fi
if [[ $ntfytopic != "" ]]; then
curl \
-H "Title: $sitename DDNS Update Failed" \
-H "Priority: urgent" \
-H "Tags: warning" \
-d "$record_name: $record_identifier ($ip)." \
$ntfyuri/$ntfytopic
fi
exit 1
;;
*)
Expand All @@ -181,6 +193,12 @@ case "$update" in
\"content\": \"$sitename Updated: $record_name's new IPv6 Address is $ip\"
}" $discorduri
fi
if [[ $ntfytopic != "" ]]; then
curl \
-H "Title: $sitename Updated" \
-d $record_name"'s new IP Address is $ip" \
$ntfyuri/$ntfytopic
fi
exit 0
;;
esac