Add NTFY_RAW
This commit is contained in:
parent
85939618c8
commit
6779d9dd1f
4 changed files with 33 additions and 29 deletions
|
@ -19,14 +19,15 @@
|
||||||
#
|
#
|
||||||
# Variables:
|
# Variables:
|
||||||
# Variable Aliases Description
|
# Variable Aliases Description
|
||||||
# --------------- --------------- -----------------------------------
|
# --------------- --------------------- -----------------------------------
|
||||||
# $NTFY_ID $id Unique message ID
|
# $NTFY_ID $id Unique message ID
|
||||||
# $NTFY_TIME $time Unix timestamp of the message delivery
|
# $NTFY_TIME $time Unix timestamp of the message delivery
|
||||||
# $NTFY_TOPIC $topic Topic name
|
# $NTFY_TOPIC $topic Topic name
|
||||||
# $NTFY_MESSAGE $message, $m Message body
|
# $NTFY_MESSAGE $message, $m Message body
|
||||||
# $NTFY_TITLE $title, $t Message title
|
# $NTFY_TITLE $title, $t Message title
|
||||||
# $NTFY_PRIORITY $priority, $p Message priority (1=min, 5=max)
|
# $NTFY_PRIORITY $priority, $prio, $p Message priority (1=min, 5=max)
|
||||||
# $NTFY_TAGS $tags, $ta Message tags (comma separated list)
|
# $NTFY_TAGS $tags, $tag, $ta Message tags (comma separated list)
|
||||||
|
# $NTFY_RAW $raw Raw JSON message
|
||||||
#
|
#
|
||||||
# Filters ('if:'):
|
# Filters ('if:'):
|
||||||
# You can filter 'message', 'title', 'priority' (comma-separated list, logical OR)
|
# You can filter 'message', 'title', 'priority' (comma-separated list, logical OR)
|
||||||
|
|
|
@ -45,14 +45,15 @@ ntfy subscribe TOPIC COMMAND
|
||||||
command as environment variables:
|
command as environment variables:
|
||||||
|
|
||||||
Variable Aliases Description
|
Variable Aliases Description
|
||||||
--------------- --------------- -----------------------------------
|
--------------- --------------------- -----------------------------------
|
||||||
$NTFY_ID $id Unique message ID
|
$NTFY_ID $id Unique message ID
|
||||||
$NTFY_TIME $time Unix timestamp of the message delivery
|
$NTFY_TIME $time Unix timestamp of the message delivery
|
||||||
$NTFY_TOPIC $topic Topic name
|
$NTFY_TOPIC $topic Topic name
|
||||||
$NTFY_MESSAGE $message, $m Message body
|
$NTFY_MESSAGE $message, $m Message body
|
||||||
$NTFY_TITLE $title, $t Message title
|
$NTFY_TITLE $title, $t Message title
|
||||||
$NTFY_PRIORITY $priority, $p Message priority (1=min, 5=max)
|
$NTFY_PRIORITY $priority, $prio, $p Message priority (1=min, 5=max)
|
||||||
$NTFY_TAGS $tags, $ta Message tags (comma separated list)
|
$NTFY_TAGS $tags, $tag, $ta Message tags (comma separated list)
|
||||||
|
$NTFY_RAW $raw Raw JSON message
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
ntfy sub mytopic 'notify-send "$m"' # Execute command for incoming messages
|
ntfy sub mytopic 'notify-send "$m"' # Execute command for incoming messages
|
||||||
|
@ -207,6 +208,7 @@ func envVars(m *client.Message) []string {
|
||||||
env = append(env, envVar(m.Title, "NTFY_TITLE", "title", "t")...)
|
env = append(env, envVar(m.Title, "NTFY_TITLE", "title", "t")...)
|
||||||
env = append(env, envVar(fmt.Sprintf("%d", m.Priority), "NTFY_PRIORITY", "priority", "prio", "p")...)
|
env = append(env, envVar(fmt.Sprintf("%d", m.Priority), "NTFY_PRIORITY", "priority", "prio", "p")...)
|
||||||
env = append(env, envVar(strings.Join(m.Tags, ","), "NTFY_TAGS", "tags", "tag", "ta")...)
|
env = append(env, envVar(strings.Join(m.Tags, ","), "NTFY_TAGS", "tags", "tag", "ta")...)
|
||||||
|
env = append(env, envVar(m.Raw, "NTFY_RAW", "raw")...)
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ Available filters (all case-insensitive):
|
||||||
|
|
||||||
| Filter variable | Alias | Example | Description |
|
| Filter variable | Alias | Example | Description |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| `message` | `X-Message`, `m` | `ntfy.sh/mytopic?some_message` | Only return messages that match this exact message string |
|
| `message` | `X-Message`, `m` | `ntfy.sh/mytopic?message=lalala` | Only return messages that match this exact message string |
|
||||||
| `title` | `X-Title`, `t` | `ntfy.sh/mytopic?title=some+title` | Only return messages that match this exact title string |
|
| `title` | `X-Title`, `t` | `ntfy.sh/mytopic?title=some+title` | Only return messages that match this exact title string |
|
||||||
| `priority` | `X-Priority`, `prio`, `p` | `ntfy.sh/mytopic?p=high,urgent` | Only return messages that match *any priority listed* (comma-separated) |
|
| `priority` | `X-Priority`, `prio`, `p` | `ntfy.sh/mytopic?p=high,urgent` | Only return messages that match *any priority listed* (comma-separated) |
|
||||||
| `tags` | `X-Tags`, `tag`, `ta` | `ntfy.sh/mytopic?tags=error,alert` | Only return messages that match *all listed tags* (comma-separated) |
|
| `tags` | `X-Tags`, `tag`, `ta` | `ntfy.sh/mytopic?tags=error,alert` | Only return messages that match *all listed tags* (comma-separated) |
|
||||||
|
|
|
@ -112,6 +112,7 @@ in double-quotes, you should be fine:
|
||||||
| `$NTFY_TITLE` | `$title`, `$t` | Message title |
|
| `$NTFY_TITLE` | `$title`, `$t` | Message title |
|
||||||
| `$NTFY_PRIORITY` | `$priority`, `$prio`, `$p` | Message priority (1=min, 5=max) |
|
| `$NTFY_PRIORITY` | `$priority`, `$prio`, `$p` | Message priority (1=min, 5=max) |
|
||||||
| `$NTFY_TAGS` | `$tags`, `$tag`, `$ta` | Message tags (comma separated list) |
|
| `$NTFY_TAGS` | `$tags`, `$tag`, `$ta` | Message tags (comma separated list) |
|
||||||
|
| `$NTFY_RAW` | `$raw` | Raw JSON message |
|
||||||
|
|
||||||
### Subscribe to multiple topics
|
### Subscribe to multiple topics
|
||||||
```
|
```
|
||||||
|
@ -147,7 +148,7 @@ Here's an example config file that subscribes to three different topics, executi
|
||||||
In this example, when `ntfy subscribe --from-config` is executed:
|
In this example, when `ntfy subscribe --from-config` is executed:
|
||||||
|
|
||||||
* Messages to `echo-this` simply echos to standard out
|
* Messages to `echo-this` simply echos to standard out
|
||||||
* Messages to `alerts` display as desktop notification for high priority messages using `notify-send`
|
* Messages to `alerts` display as desktop notification for high priority messages using [notify-send](https://manpages.ubuntu.com/manpages/focal/man1/notify-send.1.html)
|
||||||
* Messages to `calc` open the gnome calculator 😀 (*because, why not*)
|
* Messages to `calc` open the gnome calculator 😀 (*because, why not*)
|
||||||
* Messages to `print-temp` execute an inline script and print the CPU temperature
|
* Messages to `print-temp` execute an inline script and print the CPU temperature
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue