server icon indicating copy to clipboard operation
server copied to clipboard

feature request: Notifications actions

Open cyrinux opened this issue 2 years ago • 8 comments

Is your feature request related to a problem? Please describe. I miss the possibility to react directly from some notifications, from the notification itself, without the need to open the main gotify interface.

Describe the solution you'd like I would be able to pass some "extras" parameters that add some actions directly in the notifcations, like copy a text, open a link, or share a text/link, even why not call/text a contact.

Describe alternatives you've considered I tried a simple implementation of "share" and "open" a link here, its working but can be done better maybe, please take time to read this PR thread: https://github.com/gotify/android/pull/236 .

Additional context Please see this link https://github.com/gotify/android/pull/236 where you can find an example of integration with hauk-snitch project for example. Another common example is the integration of gotify with a monitoring, on-call setup. You can receive some events/alert and want to add some actions, open a link, ack an alert, escalade to another guy through call or text, copy a code you receive to the clipboard.

cyrinux avatar Jun 22 '22 19:06 cyrinux

Gotify users who read me, please feel free to add some other examples here if you want this feature to be added. 🙏🏻 And thanks @jmattheis for this great program, this feature would make me happy 😃

cyrinux avatar Jun 22 '22 19:06 cyrinux

In this issue we should decide how the "extras" are structured, I'd say we start with a button that sends an HTTP request. It could be defined like this:

{
  "title": "home assistant",
  "message": "You've left the house but the heater is still powered on.",
  "extras": {
    "client::action": {
      "buttons": [
        {
          "label": "Power off",
          "http": {
            "method": "post",
            "url": "https://example.com/power_off?id=5",
            "headers": { "Authorization": "bearer token" }
          }
        },
        {
          "label": "Dismiss",
          "http": {
            "method": "post",
            "url": "https://example.com/dismiss?id=5",
            "headers": { "Authorization": "bearer token" }
          }
        }
      ]
    }
  }
}

To users of Gotify: would this functionality improve some of your workflows and do you think the above definition with "method", "url" and "headers" is enough for defining the HTTP request?

jmattheis avatar Jun 26 '22 09:06 jmattheis

Let's mention this right away as it might affect the design decisions: android has some predefined hardcoded actions (like "share" to share content with another app - the full list seems to be here), which there is a desirable use-case to support. It is also very important to not just share the entire notification content, but be able to specify exactly what has to be shared.

Real use-case:

  • There is an app that can share my location temporarily.
  • Once started, I want to receive a notification with text "You location is being shared for 60 minutes" and a share button
  • The "share" button should use standard Android's ACTION_SEND intent, which when clicked shows android dialog to select app/contact to be shared with, and as a the content of the shared message it should be the URL to a map with my location - i.e. not the content of the Gotify notification that I received.

Hope that will help!

maximbaz avatar Jun 26 '22 10:06 maximbaz

As I was explaining in gotify/android#257, I would like to have (on the click of the notification, so no custom button for me, but it can be applied to them too) the possibility to open an application instead of opening an url. Maybe we can also specify extras for the intent too.

Real use case: I have a python script that will automate the adding of videos to my jellyfin media server and it sends a notification about the successful operation. This notification actually opens the url of the media server, instead i would like to open the jellyfin application (as I don't use the browser but the mobile app to watch videos) The same can be applied to other scenarios like tachiyomi with mangas.

Paolo7297 avatar Nov 29 '22 18:11 Paolo7297

Hello,m Any news ?

GamerClassN7 avatar Oct 30 '23 17:10 GamerClassN7

Any news on this?

errrrata avatar Mar 08 '24 18:03 errrrata

I'm open to accept PRs for the http action described in https://github.com/gotify/server/issues/494#issuecomment-1166474588.

jmattheis avatar Mar 12 '24 17:03 jmattheis

I'm open to accept PRs for the http action described in #494 (comment).

And I will not do the PR as I'm not android dev, so please, if someone can, feel free to do it please 😄

cyrinux avatar Mar 12 '24 17:03 cyrinux