-
-
Notifications
You must be signed in to change notification settings - Fork 650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actionable notifications #119
Comments
Hey @webworxshop, you're right, something like this doesn't exist. Currently links should already be clickable in the android app, so you could just add plain links to the message. This could partly be fixed with adding markdown support to messages (#65 (comment)) then it would be possible to add links with labels to the message. Do you think this is enough for your usecase? |
Hi @jmattheis, Thanks for your reply. Yes, having markdown support in messages, plus clickable links would give a mostly workable solution, but I foresee a couple of problems:
For reference, I'm basically looking for something to replace the HTML5 Push Notifications in Home Assistant (https://www.home-assistant.io/components/notify.html5/), but without the dependency on Google Cloud Messaging. Thanks again for getting back to me. |
Hello, Not knowing very much about Android notifications, I wonder if this would make it possible to open links in other apps than the browser? I'm trying to set up my gotify server as a complete replacement of the one provided by google, IE. my server would be connected to my Discord account, and when I receive a message it would send a gotify notification to my phone. What I would like is to have the notification open Discord on my phone when clicked (if it's installed). Would that be related to this issue, or should I open a new request for it? |
I agree with the downsides explained by @webworxshop. Link-based (i.e. directly in text) actions is a no-go, at least for this specific use case. Actions are designed to interact with the application owning the notification. This should be handled in a specialized way IMHO. |
stumbled upon this issue when i was looking into gotify to completely selfhost my notifications (mainly for home automation stuff but also other local events on my systems). Actionable Notifications would be really nice to have like @webworxshop described. Maybe a solution would be to use a websocket api for this, it seems a ws endoint for all messages is allready implemented (https://gotify.net/api-docs#/message/streamMessages). How about creating an additional ws endpoint like Message could be created including actions (buttons) and appropriate eventid's in message extras:
This should then render buttons in the notification with with the specified name and underlying action The action/button "No" will just dismiss the notification, but clicking on "Yes" will fire the event on the Websocket /events endpoint:
Then in node-red you can listen for the specific turnoff_radiators eventid and take appropriate actions.... I have no idea how hard this would be to implement using gotify but it would be a good solution imo. |
I don't really see the benefit in this, you could also send a normal message with extra json data, no need for an extra endpoint for this. The existing https://gotify.net/docs/msgextras were added exactly for this. The difficult part is to define the what and how it should be defined inside the extras |
Well you are correct, the proposed new api endpoint isnt really necessary and its only for the callbacks from the actions/buttons. This could be done through And yes, messages with actions/buttons/callbacks should be created like normal with those actions defined in using the messaging extras, maybe my description was a bit complicated. I will try to summerize my idea again a bit better:
Something like this would be very versatile... |
Right, I'm okay, with action buttons inside actions, but I don't think they should send events itself but rather do http requests to the relevant services to do stuff. This would be a more direct approach to solve this. |
The idea of letting gotify sending those events and not talking to the relevant services directly comes from my personal situation that i have a quite a few services i dont want to open up to the public www and are only reachable through a vpn connection from outside my lan. But since im not using the vpn connection all the time i would need to establish the connection just to use those actions in the notifications. Implementing something like i proposed would allow to communicate with those services on my private network, as gotify is the only public service and my local services are just listening for gotifys callback events. Another solution would be to implement my own publicly available event service that i could talk to from the outside but this would then also need some kind of authentication system etc. Since gotify allready handels authentication it would be a single and versitile solution Anyway, it is not my project and i just wanted to propose an idea how to handle actions. I can understand and respect if this is not the direction you prefer :) |
Alright, thanks for your explanation, I think it is too specialized to your use-case, I try to keep gotify as simple as possible (:. |
Hey, @jmattheis , is there any status on adding this as a feature ot Gotify, or are you looking for someone to pick up this work? I'm looking to write a notification manager that uses Gotify as its last-mile provider, and I would love to be able to add callback buttons to notifications to indicate whether I did the thing or need another reminder, so for a notification like "Take out trash", I'd like to be able to add callbacks like, e.g.:
I don't expect Gotify to manage the contents of either |
Alternatively, is there documentation on how to put multiple links in a notification using current configuration? |
Sure, you can use markdown -> https://gotify.net/docs/msgextras#clientdisplay |
I finally got around to attempting this, and I've got some success. I have code that passes a link through successfully to a notification -- see https://github.com/Literorrery/autoforge/blob/main/autoforge.go#L24-L33 for example -- but what I've found is that though this creates a link on the notification on my phone, when I view the same notification on WearOS, it doesn't render the markdown as a link. I'm guessing that's because currently Gotify doesn't have a WearOS client, so any notification created will be shared as a RemoteView, not with a native client. So I suppose the next question is whether there's any appetite for a WearOS Gotify client and whether you're looking for people to help with that effort. |
Feel free to write a WearOS client :P. |
is there any status on adding actionable notifications to Gotify? |
Well, "adding actionable notifications" is a pretty broad topic. Some actions do already exist on the android client, see https://gotify.net/docs/msgextras#androidaction if you want something different / new, then you probably should create an issue for this. |
Does anyone have any API request examples using message extras? The docs aren't that clear (to me, at least). |
Close in favor of #494 |
This looks like a really cool project and something I've been looking for for a while.
Please correct me if I'm wrong on this but from the documentation it doesn't look like you support actionable notifications i.e. notifications containing one or two buttons underneath which perform the respective action when clicked.
An example use case of this is that my home automation system may send a notification telling me that I left my garage door open and provide a button to close the door.
I think the simplest/most flexible way to implement the action part would be via a webhook, so the sending application would need to specify both the label text and a callback URL for when the action is clicked.
Thanks again for the great project.
The text was updated successfully, but these errors were encountered: