NotIf Documentation Pricing App

Command line

The notif program publishes messages and subscribes to topics from a terminal. It requires Node.js 22.13 or later and encodes accented characters for you.

The program is not available for download yet. In the meantime, curl does everything described in Publish and Subscribe with the API.

Configuration

Without configuration, notif targets http://localhost:2586. To use the hosted service, create the client.yml file:

default-host: https://usenotif.com
default-token: tk_yourtoken
System Location of client.yml
Linux ~/.config/notif/client.yml
macOS ~/Library/Application Support/notif/client.yml
Windows %AppData%\notif\client.yml

You can choose another file with the NOTIF_CLIENT_CONFIG variable or the --config option.

The token is optional. If needed, replace it with default-user and default-password.

You can also give the topic's full address with each command, without a configuration file:

notif publish https://usenotif.com/my-topic "Hello"

Publish

notif publish my-topic "Backup complete"

pub, send and trigger are synonyms of publish. Without a message, triggered is sent.

notif publish --title "Build complete" --priority high --tags tada my-topic "All good"
Option Role
--title Title
--priority, -P Priority
--tags Comma-separated tags
--markdown Turns on Markdown
--delay, --at, --in Scheduled delivery
--timezone Time zone of the scheduled delivery
--click Click link
--icon Icon address
--attach Address of an online file
--file Local file to attach
--filename File name
--actions Action buttons
--email Email forwarding
--call Phone call
--sequence-id Sequence ID
--no-cache Does not keep the message on the server
--no-firebase Does not go through Firebase
--quiet Does not show the server's response
-u name:password Account to use
-k token Token to use
--config Other configuration file

The only short options are -P, -u, -k and -c (for --config). Write the others in full: -t is not recognized and would be taken as the topic name.

To attach a file:

notif publish --file report.pdf my-topic "Here is the report"

Notify at the end of a command

--wait-cmd runs a command, waits for it to finish, then publishes.

notif publish --wait-cmd "npm test" my-topic

Without a message, notif sends command 'npm test' finished with exit code 0 after 12s. --cmd and --done are synonyms.

To wait for a process that is already running, give its number:

notif publish --wait-pid 8421 my-topic "The job is done"

Subscribe

notif subscribe my-topic

sub is a synonym. Each message is shown on one JSON line. The command stays active and reconnects on its own if the connection drops.

Option Role
--poll Shows the stored messages, then stops
--since Starting point: all, latest, 10m, timestamp or ID
--scheduled Includes scheduled messages
-u, -k, --config As for publishing

For example, to read the messages of the last hour:

notif subscribe --poll --since 1h my-topic

Run a command for each message

Add a command after the topic name.

notif subscribe my-topic 'echo "$NOTIF_TITLE: $NOTIF_MESSAGE"'

On Windows, use the cmd.exe syntax:

notif subscribe my-topic "echo %NOTIF_MESSAGE%"

The command receives these environment variables:

Variable Content
NOTIF_ID Message ID
NOTIF_TIME Unix timestamp
NOTIF_TOPIC Topic
NOTIF_MESSAGE Message
NOTIF_TITLE Title
NOTIF_PRIORITY Priority, from 1 to 5
NOTIF_TAGS Comma-separated tags
NOTIF_RAW Full message in JSON

The same values exist under the names NTFY_ID, NTFY_MESSAGE, etc., for your ntfy scripts.

Several subscriptions

List your topics in client.yml:

default-host: https://usenotif.com
default-token: tk_yourtoken
default-command: 'echo "$NOTIF_MESSAGE"'
subscribe:
  - topic: my-backups
  - topic: my-home
    command: 'echo "Home: $NOTIF_MESSAGE"'
    if:
      priority: high,urgent
  - topic: my-reports
    token: tk_othertoken
    if:
      tags: package

Then run:

notif subscribe --from-config

command replaces default-command for this topic. Each topic also accepts token, or user and password.

if filters the messages received. It accepts priority (one of the values), tags (all the tags), title and message (exact text).