From 2c04644b09a3b2f90118c9b2b51c6985f5ef76e5 Mon Sep 17 00:00:00 2001 From: Robin Ivehult Date: Mon, 30 Mar 2026 08:26:16 +0200 Subject: [PATCH] Bugfix and tag support in Apprise template + extras. (#276) * added tag-support to Apprise API-call * tried to clarify case on notification settings --- README.md | 16 ++++++++-------- default.config | 1 + notify_templates/notify_apprise.sh | 11 +++-------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 94fd721..77a9134 100644 --- a/README.md +++ b/README.md @@ -238,19 +238,19 @@ Further additions are welcome - suggestions or PRs! All required environment variables for each notification channel are provided in the default.config file as comments and must be uncommented and modified for your requirements. For advanced users, additional functionality is available via custom configurations and environment variables. Use cases - all configured in `dockcheck.config`: -(replace `` with the upper case name of the of the channel as listed in +(replace `` with the upper case name of the of the channel as listed in `NOTIFY_CHANNELS` variable, eg `TELEGRAM_SKIPSNOOZE`) -- To bypass the snooze feature, even when enabled, add the variable `_SKIPSNOOZE` and set it to `true`. -- To configure the channel to only send container update notifications, add the variable `_CONTAINERSONLY` and set it to `true`. -- To send notifications even when there are no updates available, add the variable `_ALLOWEMPTY` and set it to `true`. -- To use another notification output format, add the variable `_OUTPUT` and set it to `csv`, `json`, or `text`. If unset or set to an invalid value, defaults to `text`. +- To bypass the snooze feature, even when enabled, add the variable `_SKIPSNOOZE` and set it to `true`. +- To configure the channel to only send container update notifications, add the variable `_CONTAINERSONLY` and set it to `true`. +- To send notifications even when there are no updates available, add the variable `_ALLOWEMPTY` and set it to `true`. +- To use another notification output format, add the variable `_OUTPUT` and set it to `csv`, `json`, or `text`. If unset or set to an invalid value, defaults to `text`. - To send multiple notifications using the same notification template: - Strings in the `NOTIFY_CHANNELS` list are now treated as unique names and do not necessarily refer to the notification template that will be called, though they do by default. - Add another notification channel to `NOTIFY_CHANNELS` in `dockcheck.config`. The name can contain upper and lower case letters, numbers and underscores, but can't start with a number. - - Add the variable `_TEMPLATE` to `dockcheck.config` where `` is the name of the channel added above and set the value to an available notification template script (`slack`, `apprise`, `gotify`, etc.) - - Add all other environment variables required for the chosen template to function with `` in upper case as the prefix rather than the template name. - - For example, if `` is `mynotification` and the template configured is `slack`, you would need to set `MYNOTIFICATION_CHANNEL_ID` and `MYNOTIFICATION_ACCESS_TOKEN`. + - Add the variable `_TEMPLATE` to `dockcheck.config` where `` is the name of the channel added above and set the value to an available notification template script (`slack`, `apprise`, `gotify`, etc.) + - Add all other environment variables required for the chosen template to function with `` in upper case as the prefix rather than the template name. + - For example, if `` is `mynotification` and the template configured is `slack`, you would need to set `MYNOTIFICATION_CHANNEL_ID` and `MYNOTIFICATION_ACCESS_TOKEN`. #### Release notes addon diff --git a/default.config b/default.config index 0db0980..6273610 100644 --- a/default.config +++ b/default.config @@ -51,6 +51,7 @@ # pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b # tgram://{bot_token}/{chat_id}/' # APPRISE_URL="http://apprise.mydomain.tld:1234/notify/apprise" +# APPRISE_TAG="one_tag,othertag" # Only works with the URL API and need to setup tags within Apprise # # BARK_KEY="key-value" # diff --git a/notify_templates/notify_apprise.sh b/notify_templates/notify_apprise.sh index d2ab0a5..3c20743 100644 --- a/notify_templates/notify_apprise.sh +++ b/notify_templates/notify_apprise.sh @@ -1,5 +1,5 @@ ### DISCLAIMER: This is a third party addition to dockcheck - best effort testing. -NOTIFY_APPRISE_VERSION="v0.4" +NOTIFY_APPRISE_VERSION="v0.5" # # Required receiving services must already be set up. # Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script. @@ -35,17 +35,12 @@ trigger_apprise_notification() { fi fi - # e.g. APPRISE_PAYLOAD='mailto://myemail:mypass@gmail.com - # mastodons://{token}@{host} - # pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b - # tgram://{bot_token}/{chat_id}/' - if [[ -n "${!AppriseUrlVar:-}" ]]; then AppriseURL="${!AppriseUrlVar}" - curl -S -o /dev/null ${CurlArgs} -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=all" $AppriseURL # e.g. APPRISE_URL=http://apprise.mydomain.tld:1234/notify/apprise + curl -S -o /dev/null ${CurlArgs} -X POST -F "title=$MessageTitle" -F "body=$MessageBody" -F "tags=${APPRISE_TAG:-all}" "$AppriseURL" if [[ $? -gt 0 ]]; then NotifyError=true fi fi -} \ No newline at end of file +}