← All procedures

notify.send

Send a push notification through ntfy

CLI
Package
@procedures/notify · README
Path
["notify","send"]
CLI
mark notify send --topic <string> --title <string> --message <string>
As data
{"$proc":["notify","send"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/notify/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["notify","send"], { topic: "<topic>", title: "<title>", message: "<message>" });
console.log(JSON.stringify(result));

From the command line

$ mark notify send --topic <string> --title <string> --message <string>

As data, in a program

{
  "$proc": ["notify", "send"],
  "input": {
    "topic": "<topic>",
    "title": "<title>",
    "message": "<message>"
  }
}

Input

FieldTypeRequiredDefaultDescription
topicstringyesThe ntfy topic. On the public server, anyone who knows the topic can read it: use a long random name.
titlestringyesThe title of the notification
messagestringyesThe text of the notification. Do not send private content to a public server.
priority"min" | "low" | "default" | "high" | "max"no"default"The priority (default: default)
tagsstring[]noTags; ntfy shows a known tag (warning, check) as an emoji
clickstringnoThe address that a tap on the notification opens
serverstringnoAnother ntfy server (default: https://ntfy.sh)
tokenEnvstringnoThe name of the environment variable with the access token of a protected topic: NTFY_ or NOTIFY_ and more. The token is never an input.
timeoutMsintegerno20000The time limit, in milliseconds (default: 20000)

Output

FieldTypeRequiredDefaultDescription
sentbooleanyes
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "topic": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_-]{1,64}$",
        "description": "The ntfy topic. On the public server, anyone who knows the topic can read it: use a long random name."
      },
      "title": {
        "type": "string",
        "minLength": 1,
        "maxLength": 250,
        "description": "The title of the notification"
      },
      "message": {
        "type": "string",
        "maxLength": 4096,
        "description": "The text of the notification. Do not send private content to a public server."
      },
      "priority": {
        "default": "default",
        "description": "The priority (default: default)",
        "type": "string",
        "enum": [
          "min",
          "low",
          "default",
          "high",
          "max"
        ]
      },
      "tags": {
        "description": "Tags; ntfy shows a known tag (warning, check) as an emoji",
        "maxItems": 10,
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 1
        }
      },
      "click": {
        "description": "The address that a tap on the notification opens",
        "type": "string",
        "format": "uri"
      },
      "server": {
        "description": "Another ntfy server (default: https://ntfy.sh)",
        "type": "string",
        "format": "uri"
      },
      "tokenEnv": {
        "description": "The name of the environment variable with the access token of a protected topic: NTFY_ or NOTIFY_ and more. The token is never an input.",
        "type": "string",
        "pattern": "^(?:NTFY|NOTIFY)_[A-Za-z0-9_]+$"
      },
      "timeoutMs": {
        "default": 20000,
        "description": "The time limit, in milliseconds (default: 20000)",
        "type": "integer",
        "exclusiveMinimum": 0,
        "maximum": 120000
      }
    },
    "required": [
      "topic",
      "title",
      "message"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "sent": {
        "type": "boolean",
        "const": true
      }
    },
    "required": [
      "sent"
    ],
    "additionalProperties": false
  }
}