From c5ec3b48b46d352528dcf70c606d2433323c0cab Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Wed, 20 Apr 2022 19:15:15 -0400 Subject: [PATCH] Ahhh --- docs/publish.md | 64 ++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/docs/publish.md b/docs/publish.md index 2948c4e4..4c829fe5 100644 --- a/docs/publish.md +++ b/docs/publish.md @@ -805,16 +805,15 @@ all the supported fields: ## Action buttons You can add action buttons to notifications to allow yourself to react to a notification directly. This is incredibly -useful and has countless applications. As of today, the following actions are supported: +useful and has countless applications. + +As of today, the following actions are supported: * [`view`](#open-websiteapp): Opens a website or app when the action button is tapped * [`broadcast`](#send-android-broadcast): Sends an [Android broadcast](https://developer.android.com/guide/components/broadcasts) intent when the action button is tapped * [`http`](#send-http-request): Sends HTTP POST/GET/PUT request when the action button is tapped -To define the user actions, you can either pass the `actions` field as part of the JSON body (if you're -[publishing via JSON](#publish-as-json)), or use the `X-Actions` header (or any of its aliases: `Actions`, `Action`). - Here's an example of what that a notification with actions can look like:
@@ -822,8 +821,11 @@ Here's an example of what that a notification with actions can look like:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+To define the user actions, you can either pass the `actions` field as part of the JSON body (if you're +[publishing via JSON](#publish-as-json)), or use the `X-Actions` header (or any of its aliases: `Actions`, `Action`). + Using the `X-Actions` header and the **simple format** (details see below), you can create the above notification like -this. This format is much easier to write, but less powerful: +this. This format is much **easier to write, but less powerful**: === "Command line (curl)" ``` @@ -898,6 +900,38 @@ this. This format is much easier to write, but less powerful: ])); ``` +The `X-Actions` header (including above-mentioned aliases) supports the following formats: + +=== "Simple format (long)" + ``` + X-Actions: action=, label=