From ecd59da00d61f8637d28df90ddbbdd3ec14dafbf Mon Sep 17 00:00:00 2001 From: EinfacheSache <69739334+EinfacheSache@users.noreply.github.com> Date: Tue, 17 Nov 2026 19:02:52 +0100 Subject: [PATCH 1/3] docs: add client::action message extras (#494) --- docs/msgextras.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/docs/msgextras.md b/docs/msgextras.md index 92e01d7..93df62a 100644 --- a/docs/msgextras.md +++ b/docs/msgextras.md @@ -13,6 +13,7 @@ Some of the namespaces are used by official clients: | `client::*` | Reserved | | [`client::display`](#clientdisplay) | Changes how client displays information | | [`client::notification`](#clientnotification) | Customizes the notification | +| [`client::action`](#clientaction) | Adds action buttons to the message | | `android::*` | Reserved | | [`android::action`](#androidaction) | React to events | | `ios::*` | Reserved | @@ -106,6 +107,62 @@ Some of the namespaces are used by official clients: | -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- | | gotify/android | v2.3.0 | You may have to expand the notification. Added with [gotify/android#200](https://github.com/gotify/android/pull/200). | +## `client::action` + +### `buttons` + +`buttons` (array): Buttons shown with the message. Each button sends an HTTP request when it is clicked. + +| Field | Type | Description | +| ---------------- | ------ | -------------------------------------------------------------------------------- | +| `label` | string | **Required**; The text of the button. | +| `http`.`url` | string | **Required**; The URL of the request. Only `http` and `https` URLs are valid. | +| `http`.`method` | string | `GET`, `POST`, `PUT`, `PATCH` or `DELETE`, case-insensitive. **Default** `POST`. | +| `http`.`headers` | object | Headers of the request, a map of header name to string value. | + +Clients should skip invalid buttons and should not send cookies or other credentials with the request. + +> **Note**: Anyone who can send messages to an application can make the user's client send requests +> to any URL by adding buttons. Clients therefore only send the request after the user clicked the button, +> and should show the target of the request (e.g. as a tooltip). +> +> The web UI sends the request from the browser, so the target must allow +> [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) requests from the Gotify origin, +> including the `Access-Control-Allow-Headers` for custom headers. + +#### Example + +```json +{ + "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"} + } + ] + } + } +} +``` + +#### Support + +| Client | since | description | +| ---------------- | ----- | -------------------------------------------------------------------------------------------------- | +| gotify/server ui | TBD | Added with [gotify/server#1088](https://github.com/gotify/server/pull/1088). Requests via `fetch`. | + ## `android::action` ### `onReceive`.`intentUrl` From b99ebaff8c597790315b2202f299d8cfa665498c Mon Sep 17 00:00:00 2001 From: EinfacheSache <69739334+EinfacheSache@users.noreply.github.com> Date: Sun, 22 Nov 2026 01:46:53 +0100 Subject: [PATCH 2/3] docs: client::action method required, body and open buttons Matches the changes in gotify/server#1088. --- docs/msgextras.md | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/docs/msgextras.md b/docs/msgextras.md index 93df62a..8a04141 100644 --- a/docs/msgextras.md +++ b/docs/msgextras.md @@ -111,16 +111,22 @@ Some of the namespaces are used by official clients: ### `buttons` -`buttons` (array): Buttons shown with the message. Each button sends an HTTP request when it is clicked. - -| Field | Type | Description | -| ---------------- | ------ | -------------------------------------------------------------------------------- | -| `label` | string | **Required**; The text of the button. | -| `http`.`url` | string | **Required**; The URL of the request. Only `http` and `https` URLs are valid. | -| `http`.`method` | string | `GET`, `POST`, `PUT`, `PATCH` or `DELETE`, case-insensitive. **Default** `POST`. | -| `http`.`headers` | object | Headers of the request, a map of header name to string value. | - -Clients should skip invalid buttons and should not send cookies or other credentials with the request. +`buttons` (array): Buttons shown with the message. A button either sends an HTTP request (`http`) or opens a URL (`open`) when it is clicked. + +| Field | Type | Description | +| ---------------- | ------ | ------------------------------------------------------------------------------------------------ | +| `label` | string | **Required**; The text of the button. | +| `http` | object | Sends an HTTP request when clicked. A button must have either `http` or `open`, not both. | +| `http`.`method` | string | **Required**; The HTTP method, e.g. `GET`, `POST` or `PUT`, case-insensitive. | +| `http`.`url` | string | **Required**; The URL of the request. Only `http` and `https` URLs are valid. | +| `http`.`headers` | object | Headers of the request, a map of header name to string value. | +| `http`.`body` | string | The body of the request. Set a matching `Content-Type` header. Not allowed for `GET` and `HEAD`. | +| `open` | object | Opens a URL when clicked, e.g. a status page. | +| `open`.`url` | string | **Required**; The URL to open. Only `http` and `https` URLs are valid. | + +Clients should not send cookies or other credentials with the request. +The methods `CONNECT`, `TRACE` and `TRACK` are not supported. +The web UI doesn't show invalid buttons and shows the parsing error below the message instead. > **Note**: Anyone who can send messages to an application can make the user's client send requests > to any URL by adding buttons. Clients therefore only send the request after the user clicked the button, @@ -149,7 +155,16 @@ Clients should skip invalid buttons and should not send cookies or other credent }, { "label": "Dismiss", - "http": {"method": "post", "url": "https://example.com/dismiss?id=5"} + "http": { + "method": "post", + "url": "https://example.com/dismiss", + "headers": {"Content-Type": "application/json"}, + "body": "{\"id\": 5}" + } + }, + { + "label": "Open dashboard", + "open": {"url": "https://example.com/dashboard"} } ] } From d287394bcc7cc0b06239220391959ddb15778a5a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 19:38:54 +0100 Subject: [PATCH 3/3] docs: remove client::action open buttons The open url buttons were dropped from gotify/server#1088, a markdown link covers that use case. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TfcCbQtufdKZ9AtMjeVvch --- docs/msgextras.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/msgextras.md b/docs/msgextras.md index 8a04141..7e8151b 100644 --- a/docs/msgextras.md +++ b/docs/msgextras.md @@ -111,18 +111,16 @@ Some of the namespaces are used by official clients: ### `buttons` -`buttons` (array): Buttons shown with the message. A button either sends an HTTP request (`http`) or opens a URL (`open`) when it is clicked. +`buttons` (array): Buttons shown with the message. A button sends an HTTP request when it is clicked. | Field | Type | Description | | ---------------- | ------ | ------------------------------------------------------------------------------------------------ | | `label` | string | **Required**; The text of the button. | -| `http` | object | Sends an HTTP request when clicked. A button must have either `http` or `open`, not both. | +| `http` | object | **Required**; The HTTP request sent when the button is clicked. | | `http`.`method` | string | **Required**; The HTTP method, e.g. `GET`, `POST` or `PUT`, case-insensitive. | | `http`.`url` | string | **Required**; The URL of the request. Only `http` and `https` URLs are valid. | | `http`.`headers` | object | Headers of the request, a map of header name to string value. | | `http`.`body` | string | The body of the request. Set a matching `Content-Type` header. Not allowed for `GET` and `HEAD`. | -| `open` | object | Opens a URL when clicked, e.g. a status page. | -| `open`.`url` | string | **Required**; The URL to open. Only `http` and `https` URLs are valid. | Clients should not send cookies or other credentials with the request. The methods `CONNECT`, `TRACE` and `TRACK` are not supported. @@ -161,10 +159,6 @@ The web UI doesn't show invalid buttons and shows the parsing error below the me "headers": {"Content-Type": "application/json"}, "body": "{\"id\": 5}" } - }, - { - "label": "Open dashboard", - "open": {"url": "https://example.com/dashboard"} } ] }