### Install Tox for Development
Source: https://github.com/caronc/apprise/blob/master/bin/README.md
Install Tox to manage development dependencies, linting, testing, and builds. Tox handles the setup, so manual installation of requirements is not needed.
```bash
python -m pip install tox
```
--------------------------------
### Apprise Configuration File Example
Source: https://github.com/caronc/apprise/wiki/CLI_Usage
An example of how to structure an Apprise configuration file using comments and defining notification URLs.
```apache
# use hashtag/pound characters to add comments into your
# configuration file. Define all of your URLs one after
```
--------------------------------
### Install nest-asyncio
Source: https://github.com/caronc/apprise/wiki/Troubleshooting
Install the nest-asyncio library to enable calling asyncio functions from an already running event loop.
```bash
pip3 install nest-asyncio
```
--------------------------------
### Clone Repository and Install Dependencies
Source: https://github.com/caronc/apprise/blob/master/CONTRIBUTING.md
Clone the Apprise repository and install all necessary runtime and development dependencies.
```bash
git clone https://github.com/caronc/apprise.git
cd apprise
pip install .[dev]
```
```bash
pip install -e .[dev]
```
--------------------------------
### Install Apprise using pip
Source: https://github.com/caronc/apprise/blob/master/README.md
Install Apprise using pip, the Python package installer. This is the most straightforward method for most users.
```bash
pip install apprise
```
--------------------------------
### Install paho-mqtt
Source: https://github.com/caronc/apprise/wiki/Notify_mqtt
Install the required paho-mqtt library, ensuring a version less than v2.0 is used.
```bash
pip install "paho-mqtt<2.0"
```
--------------------------------
### Install pywin32 Dependency
Source: https://github.com/caronc/apprise/wiki/Notify_windows
Install the necessary dependency for Windows notifications. This is a one-time setup.
```bash
# windows:// minimum requirements
pip install pywin32
```
--------------------------------
### Setup Internal RSyslog Test Server with Docker
Source: https://github.com/caronc/apprise/wiki/Notify_rsyslog
This example demonstrates setting up a basic rsyslog server using Docker for testing purposes. It configures the server to listen on UDP port 514 and logs to a file named after the date. The logs are stored in a local 'log' directory.
```bash
cat << _EOF > dockerfile.syslog
FROM ubuntu
RUN apt update && apt install rsyslog -y
RUN echo '\$ModLoad imudp\n \\n$UDPServerRun 514\n \\n$ModLoad imtcp\n \\n$InputTCPServerRun 514\n \\n$template RemoteStore, "/var/log/remote/%\$year%-%
$Month%-%
$Day%.log"\n \\n:source, !isequal, "localhost" -?RemoteStore\n \\n:source, isequal, "last" ~ ' > /etc/rsyslog.conf
ENTRYPOINT ["rsyslogd", "-n"]
_EOF
# build it:
docker build -t mysyslog -f dockerfile.syslog .
# Now run it:
docker run --cap-add SYSLOG --restart always \
-v $(pwd)/log:/var/log \
-p 514:514 -p 514:514/udp --name rsyslog mysyslog
# In another terminal window, you can look into a directory
# relative to the location you ran the above command for a directory
# called `log`
You may need to adjust it's permissions, the log file will only get
created after you send an apprise notification.
```
--------------------------------
### Minimal Configuration (ID + Email)
Source: https://github.com/caronc/apprise/wiki/Notify_notificationapi
A minimal configuration example using only the client ID and an email address.
```bash
apprise -vv -t "Welcome" -b "Hello from Apprise" "napi://welcome_email@CID/SECRET/user123/test@example.com"
```
--------------------------------
### Install sleekxmpp for XMPP Support
Source: https://github.com/caronc/apprise/wiki/Notify_xmpp
Install the required Python library for XMPP functionality. This is a prerequisite for using Apprise with XMPP.
```bash
pip install sleekxmpp
```
--------------------------------
### MQTT Service Setup with Docker
Source: https://github.com/caronc/apprise/wiki/Notify_mqtt
Steps to set up a local MQTT broker using Docker and test notifications.
```bash
# Pull in Mosquitto (v2.x at the time)
docker pull eclipse-mosquitto
# Set up a spot for our configuration
mkdir mosquitto
cd mosquitto
cat << _EOF > mosquitto.conf
persistence false
allow_anonymous true
connection_messages true
log_type all
listener 1883
_EOF
# Now spin up an instance (we can Ctrl-C out of when we're done):
docker run --name mosquitto -p 1883:1883 \
--rm -v $(pwd)/mosquitto.conf:/mosquitto/config/mosquitto.conf \
eclipse-mosquitto
# All apprise testing can be done against this systems IP such as:
apprise -vvv -b "my=payload" "mqtt://localhost/a/simple/topic"
# Here is an example where the 'retain' flag is set:
apprise -vvv -b "my=payload" "mqtt://localhost/a/simple/topic?retain=yes"
```
--------------------------------
### Display Version
Source: https://github.com/caronc/apprise/blob/master/packaging/man/apprise.1.html
Use the -V or --version flag to show the installed Apprise version and exit.
```bash
apprise -V
```
--------------------------------
### Install Apprise using DNF/YUM
Source: https://github.com/caronc/apprise/blob/master/README.md
Install Apprise using DNF or YUM package managers on Red Hat-based systems. Ensure EPEL repository is enabled first.
```bash
# Redhat/CentOS 7.x users
yum install apprise
# Redhat/Rocky Linux 8.x+ and/or Fedora Users
dnf install apprise
```
--------------------------------
### Send Synology Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_synology_chat
Example of sending a notification to Synology Chat with a specified title, body, hostname, port, and token. Ensure the Apprise CLI is installed and configured.
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
synology://synology.home.arpa:5000/j300012fl9y0b5AW9g9Nsejb8P
```
--------------------------------
### Slack Incoming Webhook URL Example
Source: https://github.com/caronc/apprise/wiki/Notify_slack
This is an example of a Slack Incoming Webhook URL. Apprise supports this URL as-is.
```text
https://hooks.slack.com/services/T1JJ3T3L2/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7F
```
--------------------------------
### Splunk/VictorOps URL Syntax Examples
Source: https://github.com/caronc/apprise/wiki/Notify_splunk
These examples demonstrate the different ways to format the notification URL for Splunk/VictorOps, including variations with and without an entity ID, and using both the splunk:// and victorops:// schemes.
```text
splunk://{routing_key}@{apikey}
splunk://{routing_key}@{apikey}/{entity_id}
victorops://{routing_key}@{apikey}
victorops://{routing_key}@{apikey}/{entity_id}
https://alert.victorops.com/integrations/generic/20131114/alert/{apikey}/{routing_key}
https://alert.victorops.com/integrations/generic/20131114/alert/{apikey}/{routing_key}/{entity_id}
```
--------------------------------
### Apprise CLI Usage with Configuration File
Source: https://github.com/caronc/apprise/blob/master/packaging/man/apprise.1.html
Example of using the Apprise CLI when a default configuration file is referenced. No Service URL is needed.
```bash
$ apprise -vv -t "my title" -b "my notification body"
```
--------------------------------
### SendGrid Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_sendgrid
This example demonstrates how to send a basic email notification using Apprise with SendGrid. Ensure your API key, from_email (authenticated domain), and to_email are correctly configured.
```bash
# Assuming our {apikey} is abcd123-xyz
# Assuming our Authenticated Domain is example.com, we might want to
# set our {from_email} to noreply@example.com
# Assuming our {to_email} is someone@microsoft.com
apprise -vv -t "Test Message Title" -b "Test Message Body" \
sendgrid:///abcd123-xyz:noreply@example.com/someone@microsoft.com
```
--------------------------------
### Send XMPP Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_xmpp
Example of sending a test notification via XMPP. Ensure your XMPP server details (hostname, user, password, JID) are correctly configured in the URL.
```bash
# Assuming the xmpp {hostname} is localhost
# Assuming the jid is user@localhost
# - constructed using {hostname} and {userid}
# Assuming the xmpp {password} is abc123
apprise -vv -t "Test Message Title" -b "Test Message Body" \
xmpp://user:abc123@localhost
```
--------------------------------
### Sending a Basic Pushover Notification
Source: https://github.com/caronc/apprise/wiki/Notify_pushover
This example demonstrates how to send a simple Pushover notification to all configured devices using the Apprise command-line interface.
```APIDOC
## Example
Send a Pushover notification to all of our configured devices:
```bash
# Assuming our {user_key} is 435jdj3k78435jdj3k78435jdj3k78
# Assuming our {token} is abcdefghijklmnop-abcdefg
apprise -vv -t "Test Message Title" -b "Test Message Body" \
pover://435jdj3k78435jdj3k78435jdj3k78@abcdefghijklmnop-abcdefg
```
```
--------------------------------
### Send Pushjet Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_pushjet
Demonstrates how to send a test notification to a self-hosted Pushjet server. Ensure your Pushjet server is running and accessible.
```bash
# Assuming our {secret_key} is abcdefghijklmnopqrstuvwxyzabc
# Assuming our {hostname} is localhost
apprise -vv -t "Test Message Title" -b "Test Message Body" \
pjet://abcdefghijklmnopqrstuvwxyzabc@localhost
```
--------------------------------
### Get Apprise Details
Source: https://github.com/caronc/apprise/wiki/Development_API
The details() method returns a dictionary containing Apprise version, asset settings, supported schemas, and other configuration details.
```python
info = apobj.details()
```
--------------------------------
### Dockerfile for Apprise Testing
Source: https://github.com/caronc/apprise/wiki/Troubleshooting
A basic Dockerfile to set up an environment for testing Apprise URLs. It installs necessary dependencies and Apprise itself, allowing for isolated testing.
```dockerfile
##
## First define your Base - un-comment only ONE `FROM` line below for a specific
## version otherwise use the one already set to grab the latest version of Python
##
FROM 3-buster
# FROM python:3.10-buster
# FROM python:3.9-buster
# FROM python:3.8-buster
# FROM python:3.7-buster
# FROM python:3.6-buster
## You can also pull from specific versions of Python such as:
# FROM python:3.8.10-buster
##
## The following provides the basics
##
RUN apt-get update && \
apt-get install -y libgirepository1.0-dev build-essential musl-dev bash
##
## Now we install Apprise, there are several ways to do this. Un-comment
## The one you want obtain and comment out the others
##
## Obtain the latest stable branch
RUN pip3 install apprise
## Obtain a specific version of Apprise
# RUN pip3 install "apprise==1.2.0"
## Use the master branch from GitHub:
# RUN pip3 install "git+https://github.com/caronc/apprise.git"
## Use a specific branch you want to test
# RUN pip3 install "git+https://github.com/caronc/apprise.git@branch"
```
--------------------------------
### Send Ntfy Notification to Ntfy.sh Cloud Server
Source: https://github.com/caronc/apprise/wiki/Notify_ntfy
This example demonstrates sending a notification to the public ntfy.sh server. No local server setup is required.
```bash
# Assuming our {topic} is great-place
apprise -vv -t "Test Message Title" -b "Test Message Body" \
ntfy://great-place
```
--------------------------------
### Setup Gotify Server with Docker
Source: https://github.com/caronc/apprise/wiki/Notify_gotify
This snippet shows how to pull the Gotify server image and run it using Docker, exposing port 80 and mounting a volume for data persistence.
```bash
# Docker (assuming a connection to docker.io)
sudo docker pull gotify/server
sudo docker run -p 80:80 -v /var/gotify/data:$(pwd)/data gotify/server
# Then visit http://localhost
```
--------------------------------
### Apprise Tag Grouping Example 1
Source: https://github.com/caronc/apprise/wiki/config_text
Define URLs and then group them using a tag. Notifications sent to the group tag will reach all associated URLs.
```bash
# Group Example #1
# Define your URLs as per normal
user1=mailto://credentials
user2=mailto://credentials
# Then define a group
friends = user1, user2
```
--------------------------------
### AppriseAsset with Custom Plugin Paths
Source: https://github.com/caronc/apprise/wiki/decorator_notify
Prepare an AppriseAsset object to enable custom plugins by specifying directories to scan for modules. This example demonstrates initializing AppriseAsset with a single path or a list of paths.
```python
from apprise import Apprise
from apprise import AppriseAsset
# Prepare your Asset Object so that you can enable the Custom Plugins to be loaded for your
# instance of Apprise...
asset = AppriseAsset(plugin_paths="/path/to/scan")
```
```python
# You can also generate scan more then one file too:
asset = AppriseAsset(
plugin_paths=[
# iterate over all Python files found in the root of the specified path.
# This is NOT a recursive scan; see how directories work by reading
# The "Plugin Loading" section above.
"/dir/containing/many/python/libraries",
# You can optionally specify an absolute path to a Python file
"/path/to/plugin.py",
# if you point to a directory that has an __init__.py file found in it, then only
# that directory is loaded (it's similar to point to a absolute .py file).
"/path/to/dir/library"
]
)
```
--------------------------------
### Display Help Information
Source: https://github.com/caronc/apprise/wiki/CLI_Usage
Use the `--help` or `-h` flag to display all available CLI switches and options for Apprise.
```bash
# All of the switches and options available to you can be presented by adding --help (-h) to the command line:
```
--------------------------------
### Pass GET Parameters to Upstream
Source: https://github.com/caronc/apprise/wiki/Notify_Custom_Form
Prefix GET parameters with a minus (-) to have Apprise ignore them and pass them directly to the upstream server. This is useful when the upstream server expects specific GET parameters.
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"form://localhost:8080/?-token=abcdefg"
```
```bash
# If you want to pass more then one element, just chain them:
# The below would send a a POST to:
# https://example.ca/my/path?key1=value1&key2=value2
#
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"forms://example.ca/my/path?-key1=value1&-key2=value2"
```
--------------------------------
### Pass GET Parameters to Upstream Service
Source: https://github.com/caronc/apprise/wiki/Notify_Custom_JSON
Prefix GET parameters with a minus (-) to have Apprise ignore them and pass them directly to the upstream service. This is useful when the upstream service expects specific GET parameters.
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"json://localhost:8080/?-token=abcdefg"
```
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"jsons://example.ca/my/path?-key1=value1&-key2=value2"
```
--------------------------------
### Example Rocket.Chat Notification
Source: https://github.com/caronc/apprise/wiki/Notify_rocketchat
An example of how to send a Rocket.Chat notification to a specific channel using Apprise.
```bash
# Assuming our {user} is l2g
# Assuming our {password} is awes0m3!
```
--------------------------------
### Configure Custom SMTP Server Details
Source: https://github.com/caronc/apprise/wiki/Notify_email
This example outlines the parameters needed for users with custom SMTP servers, including SMTP server address, sender address, login credentials, and password.
```bash
# Assuming the {smtp_server} is mail.example.com
# Assuming the {send_from} is joe@example.com
# Assuming the {login} is user1@example.com
# Assuming the {password} is pass123
```
--------------------------------
### Display Apprise Help Information
Source: https://github.com/caronc/apprise/wiki/CLI_Usage
Use the --help flag to view all available command-line options and usage instructions for Apprise.
```bash
apprise --help
```
--------------------------------
### Install terminal-notifier
Source: https://github.com/caronc/apprise/wiki/Notify_macosx
Ensure terminal-notifier is installed on your system using Homebrew. This is a prerequisite for sending MacOS desktop notifications.
```bash
# Make sure terminal-notifier is installed into your system
brew install terminal-notifier
```
--------------------------------
### Include External Configuration Files
Source: https://github.com/caronc/apprise/wiki/config_text
Use the `include` keyword to import configuration from URLs or local files. This allows for modular configuration management.
```apache
# Perhaps this is your default configuration that is always read
# stored in ~/.config/apprise (or ~/.apprise)
# The following could import all of the configuration located on your
# Apprise API:
include http://localhost:8080/get/apprise
```
--------------------------------
### Ryver Webhook URL Example
Source: https://github.com/caronc/apprise/wiki/Notify_ryver
This is an example of a Ryver incoming webhook URL. The token is the most important part for Apprise integration.
```text
https://apprise.ryver.com/application/webhook/ckhrjW8w672m6HG
```
```text
https://{organization}.ryver.com/application/webhook/{token}
```
--------------------------------
### Initialize Apprise with Persistent Storage Path
Source: https://github.com/caronc/apprise/blob/master/README.md
Prepares a location for persistent storage to write its cached content. Setting this path enables the 'auto' operational mode for persistent storage.
```python
from apprise import Apprise
from apprise import AppriseAsset
from apprise import PersistentStoreMode
# Prepare a location the persistent storage can write it's cached content to.
# By setting this path, this immediately assumes you wish to operate the
# persistent storage in the operational 'auto' mode
asset = AppriseAsset(storage_path="/path/to/save/data")
# If you want to be more explicit and set more options, then you may do the
```
--------------------------------
### Basic Apprise Configuration Entries
Source: https://github.com/caronc/apprise/wiki/config_text
List notification URLs directly in a text file. Use '#' for comments.
```apache
# Use pound/hashtag (#) characters to comment lines
# Here is an example of a very basic entry (without tagging):
mailto://someone:theirpassword@gmail.com
slack://token_a/token_b/token_c
```
--------------------------------
### Nextcloud Notification Syntax Examples
Source: https://github.com/caronc/apprise/wiki/Notify_nextcloud
Illustrates the various URL syntaxes for connecting to Nextcloud, including secure (nclouds://) and insecure (ncloud://) connections, with and without port specification, and with user/group targets.
```text
ncloud://{hostname}/{targets}
ncloud://{hostname}:{port}/{targets}
ncloud://{admin_user}:{password}@{hostname}/{targets}
ncloud://{admin_user}:{password}@{hostname}:{port}/{targets}
nclouds://{hostname}/{targets}
nclouds://{hostname}:{port}/{targets}
nclouds://{admin_user}:{password}@{hostname}/{targets}
nclouds://{admin_user}:{password}@{hostname}:{port}/{targets}
```
```text
ncloud://{admin_user}:{password}@{hostname}/{notify_user1}/{notify_user2}/{notify_userN}
nclouds://{admin_user}:{password}@{hostname}/{notify_user1}/{notify_user2}/{notify_userN}
ncloud://{admin_user}:{password}@{hostname}/{notify_group1}/{notify_group2}/{notify_groupN}
nclouds://{admin_user}:{password}@{hostname}/{notify_group1}/{notify_group2}/{notify_groupN}
```
```text
ncloud://{admin_user}:{password}@{hostname}/{notify_group1}/{notify_user1}
nclouds://{admin_user}:{password}@{hostname}/{notify_group1}/{notify_user1}
```
--------------------------------
### IFTTT Webhook URL Example
Source: https://github.com/caronc/apprise/wiki/Notify_ifttt
This is an example of the URL generated by IFTTT's Maker Webhooks service, which contains your unique WebhookID.
```text
https://maker.ifttt.com/use/b1lUk7b9LpGakJARKBwRIZ
```
--------------------------------
### Send Microsoft Teams Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_msteams
This example demonstrates how to send a notification to Microsoft Teams using the Apprise CLI with a specific team name and webhook tokens.
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
msteams:///Apprise/T1JJ3T3L2@DEFK543/A1BRTD4JD/TIiajkdnlazkcOXrIdevi7F/
```
--------------------------------
### Combine Local and Remote Configurations (CLI)
Source: https://github.com/caronc/apprise/wiki/config
Specify multiple --config arguments to load notification services from both web servers and local file paths. This enables a flexible configuration strategy.
```bash
# you can specify as many --config (-c) lines as you want to add more
# and more notification services to be handled:
apprise -vvv --config=https://myserver/my/apprise/config \
--config=/a/path/on/the/local/pc -b "notify everything"
```
--------------------------------
### Microsoft Teams Incoming Webhook URL Example
Source: https://github.com/caronc/apprise/wiki/Notify_msteams
This is an example of a generated Microsoft Teams Incoming Webhook URL. The URL contains tokens required to send messages.
```text
https://team-name.office.com/webhook/ \
abcdefgf8-2f4b-4eca-8f61-225c83db1967@abcdefg2-5a99-4849-8efc-
c9e78d28e57d/IncomingWebhook/291289f63a8abd3593e834af4d79f9fe/
a2329f43-0ffb-46ab-948b-c9abdad9d643
```
--------------------------------
### Example XML Notification with Custom Field
Source: https://github.com/caronc/apprise/wiki/Notify_Custom_XML
This is an example of the resulting XML structure when a custom field like 'Sound' is added to the payload. The 'Sound' element is now part of the notification.
```xml
1.0
Test Message Title
info
Test Message Body
oceanwave
```
--------------------------------
### Apprise CLI Usage with Tagging
Source: https://github.com/caronc/apprise/blob/master/packaging/man/apprise.1.html
Demonstrates how to use Apprise CLI with tags to notify a subset of configured services.
```bash
$ apprise -vv --title "Will Be Late Getting Home" \
--body "Please go ahead and make dinner without me." \
--tag=family
```
--------------------------------
### Example XML Notification Structure
Source: https://github.com/caronc/apprise/wiki/Notify_Custom_XML
This is an example of the XML structure that can be posted to a web server for custom notifications. It includes fields like Version, Subject, MessageType, and Message.
```xml
1.0
What A Great Movie Downloaded Successfully
info
Plenty of details here...
```
--------------------------------
### Pass GET Parameters in POST Requests
Source: https://github.com/caronc/apprise/wiki/Notify_Custom_XML
Prefix GET parameters with a minus (-) to ensure they are passed as-is to the upstream server in a POST request, rather than being interpreted as Apprise options.
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"xml://localhost:8080/?-token=abcdefg"
```
```bash
# If you want to pass more then one element, just chain them:
# The below would send a a POST to:
# https://example.ca/my/path?key1=value1&key2=value2
#
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"xmls://example.ca/my/path?-key1=value1&-key2=value2"
```
--------------------------------
### Use Apprise CLI with Configuration File from API Server
Source: https://github.com/caronc/apprise/wiki/Notify_apprise_api
Demonstrates using the Apprise CLI with a configuration file that points to an existing Apprise API server. This allows the CLI to pull down stored configurations.
```bash
# A simple example of the Apprise CLI using a Config file instead:
# pulling down previously stored configuration
# Assuming our {hostname} is localhost
# Assuming our {port} is 8080
# Assuming our {token} is apprise
apprise --body="test message" --config=http://localhost:8080/get/apprise
```
--------------------------------
### Apprise Configuration File with Tags
Source: https://github.com/caronc/apprise/wiki/CLI_Usage
Define notification services and assign tags for selective triggering. Tags are comma or space-separated and precede the URL with an equals sign.
```apache
# Tags in a Text configuration sit in front of the URL
# - They are comma and/or space separated (if more than one
# - To mark that you are no longer specifying tags and want to identify
# the URL, you just place an equal (=) sign and write the URL:
#
# Syntax: =
# Here we set up a mailto:// URL and assign it the tags: me, and family
# maybe we are doing this to just identify our personal email and
# additionally tag ourselves with the family (which we will tag elsewhere
# too)
me,family=mailto://user:password@yahoo.com
# Here we set up a mailto:// URL and assign it the tag: family
# In this example, we would email 2 people if triggered
family=mailto://user:password@yahoo.com/myspouse@example.com/mychild@example.com
# This might be our Slack Team Server targeting the #devops channel
# We assign it the tag: team
team=slack://token_a/token_b/token_c/#general
# Maybe our company has a special devops group too idling in another
# channel; we can add that to our list too and assign it the tag: devops
devops=slack://token_a/token_b/token_c/#devops
# Here we assign all of our colleagues the tags: team, and email
team,email=mailto://user:password@yahoo.com/john@mycompany.com/jack@mycompany.com/jason@mycompany.com
# Maybe we have home automation at home, and we want to notify our
# kodi box when stuff becomes available to it
mytv=kodi://example.com
# There is no limit... fill this file to your hearts content following
# the simple logic identified above
```
--------------------------------
### Apprise Object Instantiation
Source: https://github.com/caronc/apprise/wiki/Development_API
Demonstrates how to create an instance of the Apprise object, which is the primary interface for managing notification services.
```APIDOC
## Apprise Object Instantiation
Instantiate the Apprise object to begin managing notification services.
### Code Example
```python
import apprise
apobj = apprise.Apprise()
```
```
--------------------------------
### Send Line Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_line
This example demonstrates how to send a notification to a specific Line user using the Apprise CLI. Ensure you have your Line token and user ID correctly configured.
```bash
# Assuming our {token} is 4174216298
# Assuming our {user} is U1234567
apprise -vv -t "Test Message Title" -b "Test Message Body" \
line://4174216298/U1234567
```
--------------------------------
### Apprise Priority Escalation Example
Source: https://context7.com/caronc/apprise/llms.txt
Shows how Apprise handles priority escalation based on tags defined in YAML configuration. Higher priority tags are attempted first.
```python
import apprise
# Escalation: try priority-1 (pagerduty); skip priority-5 (slack) if it succeeds
apobj = apprise.Apprise()
apobj.add(apprise.AppriseConfig(paths=['/etc/apprise/oncall.yml']))
apobj.notify(body='Database down!', tag='oncall')
# Exclusive: notify ONLY priority-2 services — no escalation
apobj.notify(body='Info update', tag='2:oncall')
# Runtime retry: retry each matched service up to 4 times on failure
apobj.notify(body='Flaky endpoint test', tag='oncall:4')
```
--------------------------------
### Slack Bot OAuth Access Token URL Examples
Source: https://github.com/caronc/apprise/wiki/Notify_slack
These are example Apprise URLs for accessing a Slack Bot using either the OAuth Access Token or the Bot User OAuth Access Token.
```text
slack://xoxp-1234-1234-1234-4ddbc191d40ee098cbaae6f3523ada2d
```
```text
slack://xoxb-1234-1234-1234-4ddbc191d40ee098cbaae6f3523ada2d
```
--------------------------------
### Load Default Configuration File
Source: https://github.com/caronc/apprise/blob/master/README.md
Use this command to send a notification using the default configuration file path.
```bash
apprise -vv -t 'my title' -b 'my notification body'
```
--------------------------------
### Send Pushsafer Notification with Emergency Priority
Source: https://github.com/caronc/apprise/wiki/Notify_pushsafer
This example demonstrates sending a Pushsafer notification with an 'emergency' priority. For emergency notifications, it is recommended to also specify 'expire' and 'retry' values, though they are not shown in this basic example.
```bash
# Emergency priority advises you to also specify the expire and
# retry values.
# Assuming our {user_key} is 435jdj3k78435jdj3k78435jdj3k78
apprise -vv -t "Test Message Title" -b "Test Message Body" \
psafers://435jdj3k78435jdj3k78435jdj3k78?priority=emergency
```
--------------------------------
### Test Demo Plugin with Apprise CLI
Source: https://github.com/caronc/apprise/wiki/DemoPlugin_WebRequest
Send a test notification using the Apprise CLI to the Demo plugin. This example uses the `demo://` schema and specifies a target URL and API key. Verbose output is enabled with `-vvv`.
```bash
# using the `apprise` found in the local bin directory allows you to test
# the new plugin right away. Use the `demo://` schema we defined. You can also
# set a couple of extra `-v` switches to add some verbosity to the output:
./bin/apprise -vvv -t test -b message demo://localhost:8080/myapikey
```
--------------------------------
### Mastodon Direct Message Example with Self-Lookup
Source: https://github.com/caronc/apprise/wiki/Notify_mastodon
This example shows how to send a direct message to yourself on Mastodon. Apprise automatically looks up your account if no user is specified in the URL and 'direct' visibility is set. The 'read:accounts' scope is mandatory for this functionality.
```bash
# Here is an example where we're specifying a `direct` message
# as our intentions are to create a DM. This will cause Apprise to look
# ourselves up and notify our own account. You MUST have the
# 'read:accounts' scope enabled on your Mastodon application or this
# will not work.
#
# Also consider there is overhead with this call as it requires an
# extra hit on the website to get your data. For efficiency, it's
```
--------------------------------
### Configure Apprise with Custom Branding and Storage
Source: https://context7.com/caronc/apprise/llms.txt
Set up Apprise with custom application details, persistent storage for stateful plugins, and custom plugin paths. Ensure secure logging by masking credentials.
```python
asset = apprise.AppriseAsset(
app_id='MyApp',
app_desc='My Application Notifications',
app_url='https://myapp.example.com',
# Async mode: True (default) = thread-pool parallel; False = sequential
async_mode=True,
# Interpret :smile: emoji shortcodes in bodies/titles
interpret_emojis=True,
# Expand \n \t escape sequences in body/title
interpret_escapes=False,
# Default body format applied to all notify() calls unless overridden
body_format=apprise.NotifyFormat.MARKDOWN,
# Persistent storage for stateful plugins (e.g. Matrix token caching)
storage_path='/var/cache/myapp/apprise',
storage_mode=PersistentStoreMode.AUTO, # auto | flush | memory
storage_idlen=8, # UID directory name length
# Load custom @notify-decorated plugins from this directory
plugin_paths=['/opt/myapp/apprise-plugins'],
# Default retry/wait for all services (overridable per-URL)
default_service_retry=2,
default_service_wait=1.0,
# Stop all escalation chains immediately on first chain failure
abort_on_chain_failure=False,
# Mask credentials in log output (CWE-312 compliance)
secure_logging=True,
)
apobj = apprise.Apprise(asset=asset)
apobj.add('matrix://user:pass@matrix.org/#general')
apobj.notify(body='Hello :wave: from **MyApp**!')
```
--------------------------------
### SendGrid Dynamic Template Usage
Source: https://github.com/caronc/apprise/wiki/Notify_sendgrid
This example shows how to use SendGrid's dynamic templates with Apprise. The `+` prefix is used to pass dynamic data to the template variables. The example URL maps `what` to `templates` and `app` to `Apprise` for substitution within the template.
```text
sendgrid://myapikey:noreply@example.com?template=d-e624763c71314ea2a1fae38d7fa64a4a&+what=templates&+app=Apprise
```
--------------------------------
### Custom Splunk mapping for info and warning
Source: https://github.com/caronc/apprise/wiki/Notify_splunk
Sends a custom Splunk message by re-mapping Apprise notification types. In this example, Apprise 'info' maps to Splunk 'RECOVERY' and Apprise 'warning' maps to Splunk 'CRITICAL'. The example sends a 'warning' which will trigger a 'CRITICAL' in Splunk.
```bash
# Assuming we want the (Apprise) `info` to to trigger a Splunk RECOVERY
# Assuming we want the (Apprise) `warning` to always trigger a Splunk CRITICAL
# Assuming our {apikey} is 134b8gh0-eba0-4fa9-ab9c-257ced0e8221
# Assuming our {route_key} is database
# In this example we'll send a warning message (which will be a CRITICAL)
apprise -vv -t "Test Message Title" -b "Test Message Body" -n warning \
splunk://database@134b8gh0-eba0-4fa9-ab9c-257ced0e8221?:info=rec&:warn=crit
```
--------------------------------
### Send a Notifico Notification
Source: https://github.com/caronc/apprise/wiki/Notify_notifico
Example of how to send a notification to Notifico using the Apprise command-line tool.
```APIDOC
## Send a Notifico Notification
### Example
```bash
# Assuming ProjectID is 2144 and MessageHook is uJmKaBW9WFk42miB146ci3Kj
apprise -vv -t "Test Message Title" -b "Test Message Body" \
notifico://2144/uJmKaBW9WFk42miB146ci3Kj
```
```
--------------------------------
### Load Configuration from Web Server (CLI)
Source: https://github.com/caronc/apprise/wiki/config
Load Apprise configuration from a remote URL using the --config argument. This allows for centralized management of notification services.
```bash
# website
apprise -vvv --config=https://myserver/my/apprise/config -b "notify everything"
```
--------------------------------
### Send a DAPNET Notification
Source: https://github.com/caronc/apprise/wiki/Notify_dapnet
Basic example of sending a test message to a single call sign.
```bash
# Assuming our {user} is df1abc
# Assuming our {password} is appriseIsAwesome
# Assuming our {callsign} - df1def
#
apprise -vv -b "Test Message Body" \
"dapnet://df1abc:appriseIsAwesome@df1def"
```
--------------------------------
### Send Pushy Notification Example
Source: https://github.com/caronc/apprise/wiki/Notify_pushy
Demonstrates how to send a test notification to a specific device using the Pushy service via the Apprise command-line interface. Ensure you replace the placeholder API key and device ID with your actual credentials.
```bash
# Assuming our {apikey} is abcdefghijklmnopqrstuvwxyzabc
# Assuming our {target} is a device with the id abcabcabc
apprise -vv -t "Test Message Title" -b "Test Message Body" \
pushy://abcdefghijklmnopqrstuvwxyzabc/@abcabcabc
```
--------------------------------
### Python Print Statement
Source: https://github.com/caronc/apprise/blob/master/tests/var/01_test_example.html
A basic Python print statement. Ensure Python is installed to run this code.
```python
print('hello')
```
--------------------------------
### Send Email with StartTLS (Default)
Source: https://github.com/caronc/apprise/wiki/Notify_email
Use this configuration to send emails using the default StartTLS protocol on port 587. If no 'to=' is specified, the 'from' address will be notified. Requires basic SMTP server, username, and password.
```bash
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"mailtos://_?user=user1@example.com&pass=pass123&smtp=mail.example.com&from=joe@example.com"
```
--------------------------------
### Send a PagerTree Create Command
Source: https://github.com/caronc/apprise/wiki/Notify_pagertree
Example of sending a basic create command to PagerTree using Apprise.
```APIDOC
## Send a PagerTree create command
#### Example
```bash
# Assuming our {integration_id} is int_0123456789
apprise -vv -t "Test Message Title" -b "Test Message Body" \
"pagertree://int_0123456789"
```
```
--------------------------------
### Send Join Notification to All Devices
Source: https://github.com/caronc/apprise/wiki/Notify_join
This example demonstrates how to send a notification to all configured devices using the 'group.all' alias. Ensure your API key is correctly substituted.
```bash
# Assuming our {apikey} is abcdefghijklmnop-abcdefg
# Assume we're sending to the group: all
apprise -vv -t "Test Message Title" -b "Test Message Body" \
join://abcdefghijklmnop-abcdefg/group.all
```
--------------------------------
### Rocket.Chat Basic Mode Syntax Examples
Source: https://github.com/caronc/apprise/wiki/Notify_rocketchat
Illustrates the various URL formats for sending notifications via basic authentication to Rocket.Chat. Ensure the correct scheme (rocket:// or rockets://) and parameters are used.
```bash
rocket://{user}:{password}@{hostname}/#{channel}
```
```bash
rocket://{user}:{password}@{hostname}:{port}/#{channel}
```
```bash
rocket://{user}:{password}@{hostname}/{room_id}
```
```bash
rocket://{user}:{password}@{hostname}:{port}/{room_id}
```
```bash
rockets://{user}:{password}@{hostname}/#{channel}
```
```bash
rockets://{user}:{password}@{hostname}:{port}/#{channel}
```
```bash
rockets://{user}:{password}@{hostname}/{room_id}
```
```bash
rockets://{user}:{password}@{hostname}:{port}/{room_id}
```
```bash
rocket://{user}:{password}@{hostname}/# {channel_id}/{room_id}
```
--------------------------------
### Example JSON Notification Payload
Source: https://github.com/caronc/apprise/wiki/Notify_Custom_JSON
Illustrates the structure of a typical JSON notification payload sent by Apprise.
```json
{
"version": "1.0",
"title": "Some Great Software Downloaded Successfully",
"message": "Plenty of details here",
"type": "info"
}
```
--------------------------------
### Triggering Wrapper with Defaults
Source: https://github.com/caronc/apprise/wiki/decorator_notify
Example of triggering a wrapper function using the default URL provided in the @notify decorator.
```bash
# The below actually triggers your wrapper with `meta` set to exactly
# what was identified above. Hence, the template/declaration is used as is.
bin/apprise -vv -b "use defaults" foobar://
```
--------------------------------
### Docker Build and Run Commands
Source: https://github.com/caronc/apprise/wiki/Troubleshooting
Commands to build a Docker image from a Dockerfile and run a container to test Apprise URLs. It shows how to build the image and execute Apprise within a container or get an interactive shell.
```shell
##
## Build Your Config
##
# Now build;
docker build --tag=apprise-test
# -OR- Use the following if your file you defined above wasn't called 'Dockerfile'
docker build --tag=apprise-test - < YourDockerConfigFile
##
## Test your config
##
# The below will run your schema:// that you wish to test
docker run -it apprise-test apprise -vvv -t "Test" -b "Message" "schema://credentials"
# Alternatively you can acquire a shell and call apprise from within there:
docker run -it apprise-test bash
# At this point you'll be inside your container, you can just call `apprise`
# from here.
```
--------------------------------
### Adding and Notifying with Custom Plugin
Source: https://github.com/caronc/apprise/wiki/decorator_notify
After preparing the AppriseAsset with custom plugin paths, initialize the Apprise object and add the custom schema. Finally, send a notification using the custom schema.
```python
# Now that we've got our asset, we just work with our Apprise object as we normally do
aobj = Apprise(asset=asset)
# If our new custom `foobar://` library was loaded (presuming we prepared one like
# in the examples above). then you would be able to safely add it into Apprise at this point
aobj.add('foobar://')
# Send our notification out through our foobar://
aobj.notify("test")
```