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"
1 Like

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.

2 Likes

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?

Been using gotify for 12 months without issues- get notifications from nodered via mqtt for events in HA etc.
Had absolutely no luck trying to push from HA notify. Tried all every single option and still nothing through.

  - name: HA-Notify
    platform: rest
    resource: http://192.168.1.199/#/messages/3
    method: POST_JSON
    headers: 
      X-Gotify-Key: tokenkey
    message_param_name: message
    title_param_name: title
    data:
      priority: 6
      extras:
        client::display:
          contentType: "text/markdown"

Really quite frustrating. Service call from HA gives me a green tick but nothing in gotify.

Your resource is wrong.
To receive out of your LAN you need to use a FQD. https://your domain.con/message

To test within your lan you can use http://yourip:port/message

Your config doesn’t have a port and should only include/message

1 Like

Thanks that has got it working.
I’m struggling with now sending an image from nodered. The below is not working with the BI integration

{
 "message": "![Camera Image](*my.hass.server*{{ states.camera.blueiris_front.attributes.entity_picture }})"
}