containrrr / shoutrrr

Notification library for gophers and their furry friends.
https://containrrr.dev/shoutrrr/
MIT License
1.01k stars 60 forks source link

Add support for Apprise #231

Open PiDroid-B opened 2 years ago

PiDroid-B commented 2 years ago

Hello,

I use Watchtower and i like this amazing project !

To improve the management of migrations, i use Apprise as a "notification broker" then i can change all the end points at the same place (i.e. : migration of mattermost, add discord channel etc... without change it on each services).

I search about integration of Apprise in Watchtower and/or Shoutrrr and found this : https://github.com/containrrr/shoutrrr/issues/59

i like a lot if i can use Apprise as like as i can use Discord or Mattermost (or everything else in this page : https://containrrr.dev/shoutrrr/v0.5/services/overview/ )

There is a futur integration of Apprise with Shoutrrr ?

Thank's a lot !

piksel commented 2 years ago

Yeah, we should probably add an apprise provider that puts the content in the body field. You can already do it by using the generic service, but you would have to make a custom template payload, which makes it a lot harder to use.

RichyHBM commented 1 year ago

Has there been any more thought in this? Or any guides on how to achieve it using the generic method?

piksel commented 1 year ago

@RichyHBM No, not really. I have not had the time to look into it, my statement above is just from a technical stand, it should be possible to do using a custom template, but it would require some trial and error. You would need to create a custom template that matches the apprise JSON body, something like:

{
   "urls": {"pbul://apikey, mailto://user:pass@gmail.com"},
   "title": {"{{ .Title }}"},
   "body": {"{{range .Entries -}}{{.Message}}{{\"\n\"}}{{- end -}}"},
   "type": {"info"},
}

and using the shoutrrr URL: generic://apprise-api-hostname/notify/ (this is assuming you are using watchtower)

simskij commented 1 year ago

Has there been any more thought in this? Or any guides on how to achieve it using the generic method?

Feel free to have a stab at it if you want! 👍🏼

TheFiZi commented 5 months ago

Has there been any more thought in this? Or any guides on how to achieve it using the generic method?

A workaround for now based on this PR: https://github.com/containrrr/shoutrrr/pull/364

Set WATCHTOWER_NOTIFICATION_URL to: generic://[APPRISE FQDN]/notify/[CONFIG ID]?template=json&messagekey=body&title=title&tags=[YOUR TAG]

Example: generic://apprise.mydomain.com/notify/my_apprise_config_id?template=json&messagekey=body&title=title&tags=discord_notifications