diff --git a/README.md b/README.md index 2e50e7d..45d8329 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,8 @@ Current templates: - Apprise (with it's [multitude](https://github.com/caronc/apprise#supported-notifications) of notifications) - both native [caronc/apprise](https://github.com/caronc/apprise) and the standalone [linuxserver/docker-apprise-api](https://github.com/linuxserver/docker-apprise-api) - Read the [QuickStart](extras/apprise_quickstart.md) +- [ntfy.sh](https://ntfy.sh/) - HTTP-based pub-sub notifications. +- [Pushbullet](https://www.pushbullet.com/) - connecting different devices with cross-platform features. Further additions are welcome - suggestions or PR! Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2). diff --git a/notify_pushbullet.sh b/notify_pushbullet.sh new file mode 100644 index 0000000..9019017 --- /dev/null +++ b/notify_pushbullet.sh @@ -0,0 +1,27 @@ +### DISCLAIMER: This is a third party addition to dockcheck - best effort testing. +# +# Copy/rename this file to notify.sh to enable the notification snippet. +# Required receiving services must already be set up. +# Requires jq installed and in PATH. +# Modify to fit your setup - set Url and Token. + +send_notification() { +Updates=("$@") +UpdToString=$( printf "%s\n" "${Updates[@]}" ) +FromHost=$(hostname) + +# platform specific notification code would go here +printf "\nSending pushbullet notification\n" + +MessageTitle="$FromHost - updates available." +# Setting the MessageBody variable here. +MessageBody="Containers on $FromHost with updates available: $UpdToString" + +# Modify to fit your setup: +PushUrl="https://api.pushbullet.com/v2/pushes" +PushToken="Your Pushbullet token here" + +# Requires jq to process json data +jq -n --arg title "$MessageTitle" --arg body "$MessageBody" '{body: $body, title: $title, type: "note"}' | curl -sS -o /dev/null --show-error --fail -X POST -H "Access-Token: $PushToken" -H "Content-type: application/json" $PushUrl -d @- + +}