Self Hosted Push Notifications with Gotify

Hi Juan,

I used your configuration. But whenever I am trying to send a notification by adding a priority the gotify server returns HTTP 400. I figured out that this is because HA sends the priority value as a string instead of an integer.

This is my configuration

  • name: gotify
    platform: rest
    resource: https://myserver/message
    method: POST_JSON
    headers:
    X-Gotify-Key: !secret gotify_api_token
    message_param_name: message
    title_param_name: title
    target_param_name: priority

This is how it looks in the network trace
grafik

If I am using the example where the priority is set with a fixed value in the notify config it says “Number value” instead. So I guess HA puts the priority value in double quotes when it sends it to the gotify server.

From HA developer tools - services I am putting the value “10” (without the double quotes) into the target field

Do you have an idea what I might be doing wrong?

Best Regards

Matthias

good day. no it doesn’t work with a priories “variable”. you need to put a fix value and possibly create different notify services with different priories.

- platform: 
  name: juan_gotify 
  resource: https://<>.com/message
  method: POST_JSON
  headers: 
    X-Gotify-Key: !secret gotify_jp_ha_key
  message_param_name: message
  title_param_name: title
  data:
    priority: 6
    extras:
      client::display:
        contentType: "text/markdown"

Thanks for the prompt reply Juan.

1 Like

Hi,

I’m a wrong to assume that with “Usage” you mean something like this, when part of an automation:

- service: notify.gotify_alarm
      data:
        title: "Alarm"
        message: "Alarm!"
        target: 7

Or should this be hard-coded in configuration.yaml?

Thank you in advance!
Erwin

Not sure it can be hard coded but you have the usage right.

Hello,

Can someone tell me how this is better than the built in notification in the home assistant android/iOS app? Not questioning the usage of Gotify more curious about learning what I can gain from switching to this.

You can use Gotify in situations where the Home Assistant app is not an option:

However, Gotify is much more limited in functionality. All notification options of the HA app are described in the documentation: https://companion.home-assistant.io/docs/notifications/notifications-basic.

There is a PR open to add a Gotify integration: Add Gotify component by benjmarshall · Pull Request #53050 · home-assistant/core · GitHub.

1 Like

Thank you very much for this clear and good answer!

What do you use for Desktop notifications?
I’ve come across this repo: https://github.com/ajmcateer/GotifyDesktop/releases
But I’m interested in your solution
Thanks

Trying out Gotify just for fun…
Noticed that in Android version it does not show image in the notification. Only if you open the app it will show up… Same for others?

Just stumbled upon Gotify and setting it up, and glad to see proper support is coming to HA for it (hopefully) soon from the PR mentioned above.

Only question I have is, will it be possible to bridge Gotify notifications to be pushed to iOS via the HA Companion App? One thing Gotify is missing is iOS support, so I’m hoping it will be possible to bridge this functionality once HA has an integration for it? Or is this something already possible to do with the code above?