CLI client
Notifly-CLI is a small command-line utility notifly for sending
messages to your channel directly from the terminal, cron jobs, and shell scripts.
It stores the token and server URL in a config, can read the message from
stdin, and can watch the output of an arbitrary command (watch) and send updates.
The utility is not required to send notifications — the same can
be done with curl (see REST API). The CLI simply saves you
from repeating the token and URL in every command.
Installation
Section titled “Installation”Prebuilt binary
Section titled “Prebuilt binary”Download the binary for your OS and make it executable:
# Linux x86-64curl -Lo notifly https://github.com/notifly/cli/releases/latest/download/notifly-cli-linux-amd64chmod +x notiflyCheck that it works:
$ notifly versionVersion: 2.2.0Commit: 95cc125e39f805a1369b0c746c8bf3af15797a57BuildDate: 2025-09-25-16:27:04If you wish, place the binary in a directory on your $PATH:
sudo mv notifly /usr/local/bin/notiflyBuild from source
Section titled “Build from source”You need Go. In the cli/ directory build the binary directly:
go build -o notifly cli.goOr use make build — it will build a set of binaries for all
platforms (Linux/macOS/Windows, amd64/386/arm64/arm) into the build/ subdirectory.
Docker
Section titled “Docker”There is a Dockerfile included (minimal Alpine image). Build the image and
run notifly in a container, mounting the config:
docker build -t notifly/cli .
docker run -it -v "$PWD/cli.json:/etc/gotify/cli.json" \ notifly/cli:latest push -p 5 "Тест из Notifly CLI"Commands
Section titled “Commands”notifly init # мастер настройки (запишет конфиг)notifly version # показать версию (алиас: v)notifly config # показать текущий конфигnotifly push # отправить сообщение (алиас: p)notifly watch # следить за выводом команды и слать измененияnotifly help # помощь по командам (алиас: h)Help for a specific command: notifly help push, notifly help watch.
Setup: notifly init
Section titled “Setup: notifly init”The easiest way to get started is the init wizard. It will ask for the server URL,
token and default priority, check the connection and write the config.
$ notifly initNotifly URL: https://notifly.ruNotifly v2.7.4@2025-09-25-16:27:04
Configure an application token1. Enter an application-token2. Create an application token (with user/pass)Enter 1 or 2: 1Application Token: A4ZudDRdLT40L5X
Default Priority [0-10]: 6
Written config to: /home/user/.gotify/cli.jsonAt the token choice step there are two options:
- 1 — enter an existing App token. Get it from the admin. The token must be exactly 15 characters; the utility will immediately verify it by sending a test message to the channel.
- 2 — create an App token using a username/password. You enter a username and password (Basic Auth), the CLI creates an application with the specified name and description and saves the returned token. The username and password are not saved — only the resulting token is stored.
The default priority must be a number from 0 to 10.
Where the config is stored
Section titled “Where the config is stored”init will offer to choose a path, and other commands search for the config in these
locations (the first found wins):
./cli.json(next to the current directory);$XDG_CONFIG_HOME/gotify/cli.json(usually~/.config/gotify/cli.json);~/.gotify/cli.json;/etc/gotify/cli.json(except on Windows).
Manual config
Section titled “Manual config”The config is just JSON. You can create it manually without running the wizard:
{ "token": "A4ZudDRdLT40L5X", "url": "https://notifly.ru", "defaultPriority": 6}| Field | Description | Example |
|---|---|---|
token | App token (Client token will not work) | A4ZudDRdLT40L5X |
url | URL of your Notifly server | https://notifly.ru |
defaultPriority | Default priority (0 if not set) | 6 |
To see which config is being used now:
$ notifly configUsed Config: /home/user/.gotify/cli.jsonURL: https://notifly.ruDefault Priority: 6Token: A4ZudDRdLT40L5XSending messages: notifly push
Section titled “Sending messages: notifly push”The message text can be provided as an argument or via stdin:
notifly push my messagenotifly push "моё сообщение"echo "моё сообщение" | notifly pushnotifly push < somefileTitle and priority:
notifly push -t "Deploy" -p 10 "Production deployed"Flags for the push command:
| Flag | Purpose | Default |
|---|---|---|
-p, --priority | Message priority | from defaultPriority |
-t, --title | Title (if empty — application name is used) | application name |
--token | Override App token (env: GOTIFY_TOKEN) | from config |
--url | Override server URL | from config |
-q, --quiet | Print nothing on success | off |
--contentType | Message content-type, e.g. text/markdown (see msgextras) | — |
--clickUrl | URL opened when the notification is clicked (see msgextras) | — |
--bigImageUrl | URL of an image shown in the notification (see msgextras) | — |
--disable-unescape-backslash | Do not unescape \n and \t (leave them as literal text) | unescapes |
If -p is not specified, defaultPriority from the config is used; if that is absent —
priority 0 is used.
Overriding token and URL
Section titled “Overriding token and URL”You don’t have to keep a config — you can pass the token and URL directly on the command
line or via the GOTIFY_TOKEN environment variable:
notifly push --url https://notifly.ru --token A4ZudDRdLT40L5X "without config"
GOTIFY_TOKEN=A4ZudDRdLT40L5X notifly push --url https://notifly.ru "from env"Markdown and line breaks
Section titled “Markdown and line breaks”By default notifly unescapes \n and \t into real line breaks and tabs.
This is convenient for multi-line messages provided as a single-line argument:
notifly push -t "Report" "Line 1\nLine 2\twith tab"To keep \n and \t as literal text — add --disable-unescape-backslash.
Markdown is enabled via --contentType:
notifly push --contentType text/markdown -t "Release" "**v2.0** is ready — [changelog](https://notifly.ru)"Clickable notifications and images
Section titled “Clickable notifications and images”notifly push -t "Build failed" \ --clickUrl https://ci.example.com/build/42 \ --bigImageUrl https://ci.example.com/build/42/graph.png \ "Job #42 finished with an error"More about these fields — see the Message extras page.
Watching a command: notifly watch
Section titled “Watching a command: notifly watch”watch periodically runs the given command and as soon as its output
has changed compared to the previous run, sends the new output to the channel.
Useful for simple ad-hoc monitoring without a separate service.
notifly watch "curl -s https://api.example.com/status | jq '.state'"By default the command runs every 2 seconds via sh -c. The title, if not set,
defaults to the command itself.
Flags for the watch command:
| Flag | Purpose | Default |
|---|---|---|
-n, --interval | Polling interval in seconds (fractional allowed) | 2 |
-p, --priority | Priority | from defaultPriority |
-x, --exec | What to use to execute the command | sh -c |
-t, --title | Title (if empty — the command text is used) | command |
--token | Override App token (env: GOTIFY_TOKEN) | from config |
--url | Override server URL | from config |
-o, --output | Detail level of the message body: short, default, long | default |
--output modes:
short— only the new output, without wrappers;default— the new output wrapped in== BEGIN NEW OUTPUT == … == END NEW OUTPUT ==;long— both old and new output (full diff in OLD/NEW blocks).
Example: watch the number of containers every 30 seconds and send a long diff:
notifly watch -n 30 -o long -t "docker ps" "docker ps -q | wc -l"TLS and self-signed certificates
Section titled “TLS and self-signed certificates”If the server uses a self-signed certificate, there are environment variables:
# completely disable TLS verification (insecure)export NOTIFLY_SKIP_VERIFY_TLS=True
# or specify a custom root CA / pinned certificateexport SSL_CERT_FILE=/path/to/cert.pemAlternative without the CLI: curl
Section titled “Alternative without the CLI: curl”Any send performed by the CLI can be reproduced with plain curl — it’s the same REST API:
curl -X POST "$NOTIFLY_URL/message" \ -H "X-Notifly-Key: A4ZudDRdLT40L5X" \ -F "title=Деплой" \ -F "priority=10" \ -F "message=Прод выкатился"REST API
Section titled “REST API”The CLI works over the same public API as everything else.
Authorization — the X-Notifly-Key header with an App token (A…).
| Method | Path | Purpose | Token |
|---|---|---|---|
POST | /message | Send a message to the channel | App token |
GET | /version | Server version (used by the init wizard) | — |
Body for POST /message (JSON or form-data): message (required), title,
priority (0–10), extras (for example client::display.contentType,
client::notification.click.url, client::notification.bigImageUrl).
Details — on the Sending messages and
Message extras pages.