Aller au contenu

Usage & Arguments

Ce contenu n’est pas encore disponible dans votre langue.

This guide covers everything from basic flags to advanced scripting techniques with the Apprise CLI.

You can view the full help menu at any time by running apprise --help.

FlagLong flagDescription
-b--bodyThe message body to send. If omitted, Apprise reads from stdin.
-t--titleThe message title (optional).
-n--notification-typeNotification type. Values: info, success, warning, failure. Default is info.
-i--input-formatInput format. Values: text, html, markdown. Default is text.
-e--interpret-escapesInterpret backslash escapes in --body (for example \n, \r).
-j--interpret-emojisInterpret emoji shortcodes in --body (for example :smile:).
-T--themeSet the default theme.
FlagLong flagDescription
-c--configOne or more configuration locations (local file or remote URL).
-g--tagFilter which services to notify (see Tag filtering).
-R--recursion-depthMaximum number of recursive include directives allowed while loading config. Default is 1. Set to 0 to ignore include/import statements.
-P--plugin-pathAdd one or more paths to scan for custom notification plugins.
FlagLong flagDescription
-a--attachOne or more attachment locations (local file path or URL). Can be specified multiple times.

Apprise supports a persistent storage cache. You can tune it with the flags below, or use the apprise storage subcommand.

FlagLong flagDescription
-S--storage-pathPath to the persistent storage caching location.
-SM--storage-modeStorage mode. Values: auto, flush, memory. Default is auto.
-SPD--storage-prune-daysNumber of days used for storage prune. Default is 30. Set to 0 to delete all accumulated content.
-SUL--storage-uid-lengthNumber of unique characters used to store persistent cache in. Default is 8.
FlagLong flagDescription
-Da--disable-asyncSend synchronously (one after the other) instead of in parallel.
-d--dry-runTrial run. Prints which services would be triggered to stdout. Does not send notifications.
-l--detailsPrint details about currently supported services.
-v--verboseIncrease verbosity. You can stack it (for example -vvvv).
-D--debugDebug mode, useful for troubleshooting.
-V--versionPrint version and exit.

You can pre-set default behaviors using environment variables. This is useful for containerized environments or setting system-wide defaults.

VariableDescription
APPRISE_URLSDefault service URLs to notify if none are provided on the command line. Space and/or comma delimited. If --config is specified, it overrides any APPRISE_URLS reference.
APPRISE_CONFIG_PATHOverride the default configuration search paths. Use ;, \n, and/or \r to delimit multiple entries.
APPRISE_PLUGIN_PATHOverride the default plugin search paths. Use ;, \n, and/or \r to delimit multiple entries.
APPRISE_STORAGE_PATHOverride the default persistent storage path.

You can send files alongside your notifications using the --attach (-a) flag. Apprise handles the upload logic automatically for services that support it (like Discord, Slack, and Telegram).

Send a log file or image from your local disk.

Terminal window
apprise \
--title "System Log" \
--body "See attached log for details" \
--attach "/var/log/syslog" \
"discord://webhook_id/webhook_token"

Apprise can fetch a file from a URL and forward it as an attachment.

Terminal window
# Apprise downloads the image and sends it to Telegram
apprise \
--title "Front Door" \
--body "Motion detected" \
--attach "http://camera-ip/snapshot.jpg" \
"tgram://bot_token/chat_id"

You can specify the flag multiple times to send several files at once.

Terminal window
apprise \
--body "Here are the build artifacts" \
--attach "release-notes.txt" \
--attach "build.zip" \
"slack://tokenA/tokenB/tokenC"

Apprise allows you to target specific subsets of your configuration using tags.

Use --tag (-g) to specify one or more tags to filter which services to notify:

  • -g "tagA" -g "tagB": Match tagA OR tagB (Union).
  • -g "tagA,tagB": Match tagA AND tagB (Strict).
  • -g "all": Notify ALL services (tagged and untagged).
  • (Omitted): Notify untagged services only.

Another way to look at it:

  • OR Logic: To notify services that have either Tag A OR Tag B, use the --tag switch multiple times.
  • AND Logic: To notify services that have both Tag A AND Tag B, separate tags with a comma within a single switch.
Terminal window
# Notify services tagged 'devops' OR 'admin'
apprise -t "Union Test" --config apprise.yml \
--tag devops --tag admin
# Notify services tagged with BOTH 'devops' AND 'critical'
apprise -t "Intersection Test" --config apprise.yml \
--tag "devops,critical"
# Trigger a configuration stored under the key 'my-alerts' on a local
# Apprise API server using the key 'my-alerts'
apprise -t "Job Finished" \
"apprise://localhost:8000/my-alerts"
# Trigger a secure remote instance, targeting only the 'devops' tag
apprise -t "Production Issue" \
--tag devops \
"apprises://apprise.example.com/234-3242-23-2111-34"

By default, Apprise treats the body as plain text. You can change this using --input-format.

Terminal window
# Send a Markdown formatted message
apprise -t "Build Status" -b "**Success**: The build passed!" \
--input-format markdown \
"discord://..."

Use --interpret-emojis (-j) to convert emoji shortcodes into actual emojis.

Terminal window
apprise \
--title "Server Status" \
--body "The server is on :fire:. Please send help :ambulance:." \
--interpret-emojis \
"slack://..."

Use --interpret-escapes (-e) when you want \n sequences in your body to become real newlines.

Terminal window
apprise \
--title "Multi-line" \
--body "Line 1\\nLine 2\\nLine 3" \
--interpret-escapes \
"discord://..."

If you are running a self-hosted Apprise API instance, you can use the CLI to trigger it using the apprise:// schema. This allows you to centralize your configuration on the server and keep your local clients simple.

  • Insecure (HTTP): apprise://hostname/config_key
  • Secure (HTTPS): apprises://hostname/config_key

Examples:

Terminal window
# Trigger a configuration stored under the key 'my-alerts' on a local server
apprise -t "Job Finished" \
"apprise://localhost:8000/my-alerts"
# Trigger a secure remote instance, targeting only the 'devops' tag
apprise -t "Production Issue" \
--tag devops \
"apprises://[apprise.example.com/production-key](https://apprise.example.com/production-key)"

The CLI is designed to work seamlessly with standard system pipes and scripts.

If you omit --body, Apprise reads from stdin.

Terminal window
cat << '_EOF' | apprise --title "Database Status" \
--notification-type success "discord://..."
Backup started: 10:00 AM
Backup finished: 10:05 AM
Status: SUCCESS
_EOF

Redirect the contents of a file directly into the message body.

Terminal window
cat ~/notes.txt | apprise --title "Daily Notes" \
"mailto://user:pass@example.com"

If you have a multi-line variable in your script, wrap it in quotes to preserve newlines.

Terminal window
MULTILINE_VAR="""
This variable has been defined
with multiple lines in it.
"""
apprise --title "Variable Example" \
--body "$MULTILINE_VAR" \
"gotify://localhost"

Persistent storage writes to the following location by default, unless APPRISE_STORAGE_PATH or --storage-path overrides it:

  • ~/.local/share/apprise/cache

Apprise can cache certain lookups and authentication details on disk to reduce repeated API calls. This is enabled by default for the CLI (mode auto). :contentReference[oaicite:14]{index="14"}

To interact with storage, use the storage subcommand:

Terminal window
apprise storage

For the full explanation (UIDs, cache locations, screenshots, and cleanup workflows), see Persistent Storage.

The Apprise CLI exits with:

  • 0 if all notifications were sent successfully.
  • 1 if one or more notifications could not be sent.
  • 2 if there was a command line error (for example, invalid arguments).
  • 3 if one or more service URLs were successfully loaded, but none could be notified due to user filtering (tags).

You can link the tmux alert-bell hook to Apprise to get notifications when long-running commands complete.

Terminal window
# 1. Set your tmux bell-action to 'other'
set-option -g bell-action other
# 2. Trigger Apprise on 'alert-bell'
set-hook -g alert-bell 'run-shell "\
apprise \
--title \"Tmux notification on #{host}\" \
--body \"Session #{session_name} window #{window_index}:#{window_name}\" \
--notification-type info \
discord://webhook_id/webhook_token"'