Skip to content
forked from caronc/apprise

Apprise - Push Notifications that work with just about every platform!

License

Notifications You must be signed in to change notification settings

TheRagna/apprise

Β 
Β 

Repository files navigation

Apprise Logo


apΒ·prise / verb
To inform or tell (someone). To make one aware of something.


Apprise allows you to send a notification to almost all of the most popular notification services available to us today such as: Telegram, Discord, Slack, Amazon SNS, Gotify, etc.

  • One notification library to rule them all.
  • A common and intuitive notification syntax.
  • Supports the handling of images and attachments (to the notification services that will accept them).

System owners who wish to provide a notification service no longer need to research each and every new one as they appear. They just need to include this one library and then they can immediately gain access to almost all of the notifications services available to us today.

System Administrators who wish to send a notification from a scheduled task or from the command line also no longer need to find the right tool for the job. Everything is already wrapped and supported within the apprise script that ships with this product.

Paypal Follow
Discord Python Build Status CodeCov Status PyPi

Supported Notifications

The section identifies all of the services supported by this library. Check out the wiki for more information on the supported modules here.

Popular Notification Services

The table below identifies the services this tool supports and some example service urls you need to use in order to take advantage of it. Click on any of the services listed below to get more details on how you can configure Apprise to access them.

Notification Service Service ID Default Port Example Syntax
Boxcar boxcar:https:// (TCP) 443 boxcar:https://hostname
boxcar:https://hostname/@tag
boxcar:https://hostname/device_token
boxcar:https://hostname/device_token1/device_token2/device_tokenN
boxcar:https://hostname/@tag/@tag2/device_token
Discord discord:https:// (TCP) 443 discord:https://webhook_id/webhook_token
discord:https://avatar@webhook_id/webhook_token
Emby emby:https:// or embys:https:// (TCP) 8096 emby:https://user@hostname/
emby:https://user:password@hostname
Enigma2 enigma2:https:// or enigma2s:https:// (TCP) 80 or 443 enigma2:https://hostname
Faast faast:https:// (TCP) 443 faast:https://authorizationtoken
Flock flock:https:// (TCP) 443 flock:https://token
flock:https://botname@token
flock:https://app_token/u:userid
flock:https://app_token/g:channel_id
flock:https://app_token/u:userid/g:channel_id
Gitter gitter:https:// (TCP) 443 gitter:https://token/room
gitter:https://token/room1/room2/roomN
Gotify gotify:https:// or gotifys:https:// (TCP) 80 or 443 gotify:https://hostname/token
gotifys:https://hostname/token?priority=high
Growl growl:https:// (UDP) 23053 growl:https://hostname
growl:https://hostname:portno
growl:https://password@hostname
growl:https://password@hostname:port
Note: you can also use the get parameter version which can allow the growl request to behave using the older v1.x protocol. An example would look like: growl:https://hostname?version=1
IFTTT ifttt:https:// (TCP) 443 ifttt:https://webhooksID/Event
ifttt:https://webhooksID/Event1/Event2/EventN
ifttt:https://webhooksID/Event1/?+Key=Value
ifttt:https://webhooksID/Event1/?-Key=value1
Join join:https:// (TCP) 443 join:https://apikey/device
join:https://apikey/device1/device2/deviceN/
join:https://apikey/group
join:https://apikey/groupA/groupB/groupN
join:https://apikey/DeviceA/groupA/groupN/DeviceN/
KODI kodi:https:// or kodis:https:// (TCP) 8080 or 443 kodi:https://hostname
kodi:https://user@hostname
kodi:https://user:password@hostname:port
Kumulos kumulos:https:// (TCP) 443 kumulos:https://apikey/serverkey
Mailgun mailgun:https:// (TCP) 443 mailgun:https://user@hostname/apikey
mailgun:https://user@hostname/apikey/email
mailgun:https://user@hostname/apikey/email1/email2/emailN
mailgun:https://user@hostname/apikey/?name="From%20User"
Matrix matrix:https:// or matrixs:https:// (TCP) 80 or 443 matrix:https://hostname
matrix:https://user@hostname
matrixs:https://user:pass@hostname:port/#room_alias
matrixs:https://user:pass@hostname:port/!room_id
matrixs:https://user:pass@hostname:port/#room_alias/!room_id/#room2
matrixs:https://token@hostname:port/?webhook=matrix
matrix:https://user:token@hostname/?webhook=slack&format=markdown
Mattermost mmost:https:// (TCP) 8065 mmost:https://hostname/authkey
mmost:https://hostname:80/authkey
mmost:https://user@hostname:80/authkey
mmost:https://hostname/authkey?channel=channel
mmosts:https://hostname/authkey
mmosts:https://user@hostname/authkey
Microsoft Teams msteams:https:// (TCP) 443 msteams:https://TokenA/TokenB/TokenC/
Nextcloud ncloud:https:// or nclouds:https:// (TCP) 80 or 443 ncloud:https://adminuser:pass@host/User
nclouds:https://adminuser:pass@host/User1/User2/UserN
Notica notica:https:// (TCP) 443 notica:https://Token/
Notifico notifico:https:// (TCP) 443 notifico:https://ProjectID/MessageHook/
Office 365 o365:https:// (TCP) 443 o365:https://TenantID:AccountEmail/ClientID/ClientSecret
o365:https://TenantID:AccountEmail/ClientID/ClientSecret/TargetEmail
o365:https://TenantID:AccountEmail/ClientID/ClientSecret/TargetEmail1/TargetEmail2/TargetEmailN
PopcornNotify popcorn:https:// (TCP) 443 popcorn:https://ApiKey/ToPhoneNo
popcorn:https://ApiKey/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
popcorn:https://ApiKey/ToEmail
popcorn:https://ApiKey/ToEmail1/ToEmail2/ToEmailN/
popcorn:https://ApiKey/ToPhoneNo1/ToEmail1/ToPhoneNoN/ToEmailN
Prowl prowl:https:// (TCP) 443 prowl:https://apikey
prowl:https://apikey/providerkey
PushBullet pbul:https:// (TCP) 443 pbul:https://accesstoken
pbul:https://accesstoken/#channel
pbul:https://accesstoken/A_DEVICE_ID
pbul:https://accesstoken/[email protected]
pbul:https://accesstoken/#channel/#channel2/[email protected]/DEVICE
Pushjet pjet:https:// or pjets:https:// (TCP) 80 or 443 pjet:https://hostname/secret
pjet:https://hostname:port/secret
pjets:https://secret@hostname/secret
pjets:https://hostname:port/secret
Push (Techulus) push:https:// (TCP) 443 push:https://apikey/
Pushed pushed:https:// (TCP) 443 pushed:https://appkey/appsecret/
pushed:https://appkey/appsecret/#ChannelAlias
pushed:https://appkey/appsecret/#ChannelAlias1/#ChannelAlias2/#ChannelAliasN
pushed:https://appkey/appsecret/@UserPushedID
pushed:https://appkey/appsecret/@UserPushedID1/@UserPushedID2/@UserPushedIDN
Pushover pover:https:// (TCP) 443 pover:https://user@token
pover:https://user@token/DEVICE
pover:https://user@token/DEVICE1/DEVICE2/DEVICEN
Note: you must specify both your user_id and token
PushSafer psafer:https:// or psafers:https:// (TCP) 80 or 443 psafer:https://privatekey
psafers:https://privatekey/DEVICE
psafer:https://privatekey/DEVICE1/DEVICE2/DEVICEN
Rocket.Chat rocket:https:// or rockets:https:// (TCP) 80 or 443 rocket:https://user:password@hostname/RoomID/Channel
rockets:https://user:password@hostname:443/#Channel1/#Channel1/RoomID
rocket:https://user:password@hostname/#Channel
rocket:https://webhook@hostname
rockets:https://webhook@hostname/@User/#Channel
Ryver ryver:https:// (TCP) 443 ryver:https://Organization/Token
ryver:https://botname@Organization/Token
SendGrid sendgrid:https:// (TCP) 443 sendgrid:https://APIToken:FromEmail/
sendgrid:https://APIToken:FromEmail/ToEmail
sendgrid:https://APIToken:FromEmail/ToEmail1/ToEmail2/ToEmailN/
SimplePush spush:https:// (TCP) 443 spush:https://apikey
spush:https://salt:password@apikey
spush:https://apikey?event=Apprise
Slack slack:https:// (TCP) 443 slack:https://TokenA/TokenB/TokenC/
slack:https://TokenA/TokenB/TokenC/Channel
slack:https://botname@TokenA/TokenB/TokenC/Channel
slack:https://user@TokenA/TokenB/TokenC/Channel1/Channel2/ChannelN
Spontit spontit:https:// (TCP) 443 spontit:https://UserID@APIKey/
spontit:https://UserID@APIKey/Channel
spontit:https://UserID@APIKey/Channel1/Channel2/ChannelN
Syslog syslog:https:// n/a syslog:https://
syslog:https://Facility
Telegram tgram:https:// (TCP) 443 tgram:https://bottoken/ChatID
tgram:https://bottoken/ChatID1/ChatID2/ChatIDN
Twitter twitter:https:// (TCP) 443 twitter:https://CKey/CSecret/AKey/ASecret
twitter:https://user@CKey/CSecret/AKey/ASecret
twitter:https://CKey/CSecret/AKey/ASecret/User1/User2/User2
twitter:https://CKey/CSecret/AKey/ASecret?mode=tweet
Twist twist:https:// (TCP) 443 twist:https://pasword:login
twist:https://password:login/#channel
twist:https://password:login/#team:channel
twist:https://password:login/#team:channel1/channel2/#team3:channel
XBMC xbmc:https:// or xbmcs:https:// (TCP) 8080 or 443 xbmc:https://hostname
xbmc:https://user@hostname
xbmc:https://user:password@hostname:port
XMPP xmpp:https:// or xmpps:https:// (TCP) 5222 or 5223 xmpp:https://password@hostname
xmpp:https://user:password@hostname
xmpps:https://user:password@hostname:port?jid=user@hostname/resource
xmpps:https://password@hostname/target@myhost, target2@myhost/resource
Webex Teams (Cisco) wxteams:https:// (TCP) 443 wxteams:https://Token
Zulip Chat zulip:https:// (TCP) 443 zulip:https://botname@Organization/Token
zulip:https://botname@Organization/Token/Channel
zulip:https://botname@Organization/Token/Email

SMS Notification Support

Notification Service Service ID Default Port Example Syntax
AWS SNS sns:https:// (TCP) 443 sns:https://AccessKeyID/AccessSecretKey/RegionName/+PhoneNo
sns:https://AccessKeyID/AccessSecretKey/RegionName/+PhoneNo1/+PhoneNo2/+PhoneNoN
sns:https://AccessKeyID/AccessSecretKey/RegionName/Topic
sns:https://AccessKeyID/AccessSecretKey/RegionName/Topic1/Topic2/TopicN
ClickSend clicksend:https:// (TCP) 443 clicksend:https://user:pass@PhoneNo
clicksend:https://user:pass@ToPhoneNo1/ToPhoneNo2/ToPhoneNoN
D7 Networks d7sms:https:// (TCP) 443 d7sms:https://user:pass@PhoneNo
d7sms:https://user:pass@ToPhoneNo1/ToPhoneNo2/ToPhoneNoN
Kavenegar kavenegar:https:// (TCP) 443 kavenegar:https://ApiKey/ToPhoneNo
kavenegar:https://FromPhoneNo@ApiKey/ToPhoneNo
kavenegar:https://ApiKey/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN
MessageBird msgbird:https:// (TCP) 443 msgbird:https://ApiKey/FromPhoneNo
msgbird:https://ApiKey/FromPhoneNo/ToPhoneNo
msgbird:https://ApiKey/FromPhoneNo/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
MSG91 msg91:https:// (TCP) 443 msg91:https://AuthKey/ToPhoneNo
msg91:https://SenderID@AuthKey/ToPhoneNo
msg91:https://AuthKey/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
Nexmo nexmo:https:// (TCP) 443 nexmo:https://ApiKey:ApiSecret@FromPhoneNo
nexmo:https://ApiKey:ApiSecret@FromPhoneNo/ToPhoneNo
nexmo:https://ApiKey:ApiSecret@FromPhoneNo/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
Sinch sinch:https:// (TCP) 443 sinch:https://ServicePlanId:ApiToken@FromPhoneNo
sinch:https://ServicePlanId:ApiToken@FromPhoneNo/ToPhoneNo
sinch:https://ServicePlanId:ApiToken@FromPhoneNo/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
sinch:https://ServicePlanId:ApiToken@ShortCode/ToPhoneNo
sinch:https://ServicePlanId:ApiToken@ShortCode/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
Twilio twilio:https:// (TCP) 443 twilio:https://AccountSid:AuthToken@FromPhoneNo
twilio:https://AccountSid:AuthToken@FromPhoneNo/ToPhoneNo
twilio:https://AccountSid:AuthToken@FromPhoneNo/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/
twilio:https://AccountSid:AuthToken@ShortCode/ToPhoneNo
twilio:https://AccountSid:AuthToken@ShortCode/ToPhoneNo1/ToPhoneNo2/ToPhoneNoN/

Desktop Notification Support

Notification Service Service ID Default Port Example Syntax
Linux DBus Notifications dbus:https://
qt:https://
glib:https://
kde:https://
n/a dbus:https://
qt:https://
glib:https://
kde:https://
Linux Gnome Notifications gnome:https:// n/a gnome:https://
MacOS X Notifications macosx:https:// n/a macosx:https://
Windows Notifications windows:https:// n/a windows:https://

Email Support

Service ID Default Port Example Syntax
mailto:https:// (TCP) 25 mailto:https://userid:[email protected]
mailto:https://domain.com?user=userid&pass=password
mailto:https://domain.com:2525?user=userid&pass=password
mailto:https://[email protected]&pass=password
mailto:https://mySendingUsername:[email protected]?to=[email protected]
mailto:https://userid:[email protected]?smtp=mail.example.com&from=[email protected]&name=no%20reply
mailtos:https:// (TCP) 587 mailtos:https://userid:[email protected]
mailtos:https://domain.com?user=userid&pass=password
mailtos:https://domain.com:465?user=userid&pass=password
mailtos:https://[email protected]&pass=password
mailtos:https://mySendingUsername:[email protected]?to=[email protected]
mailtos:https://userid:[email protected]?smtp=mail.example.com&from=[email protected]&name=no%20reply

Apprise have some email services built right into it (such as yahoo, fastmail, hotmail, gmail, etc) that greatly simplify the mailto:https:// service. See more details here.

Custom Notifications

Post Method Service ID Default Port Example Syntax
JSON json:https:// or jsons:https:// (TCP) 80 or 443 json:https://hostname
json:https://user@hostname
json:https://user:password@hostname:port
json:https://hostname/a/path/to/post/to
XML xml:https:// or xmls:https:// (TCP) 80 or 443 xml:https://hostname
xml:https://user@hostname
xml:https://user:password@hostname:port
xml:https://hostname/a/path/to/post/to

Installation

The easiest way is to install this package is from pypi:

pip install apprise

Command Line

A small command line tool is also provided with this package called apprise. If you know the server url's you wish to notify, you can simply provide them all on the command line and send your notifications that way:

# Send a notification to as many servers as you want
# as you can easily chain one after another (the -vv provides some
# additional verbosity to help let you know what is going on):
apprise -vv -t 'my title' -b 'my notification body' \
   'mailto:https://myemail:[email protected]' \
   'pbul:https://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b'

# If you don't specify a --body (-b) then stdin is used allowing
# you to use the tool as part of your every day administration:
cat /proc/cpuinfo | apprise -vv -t 'cpu info' \
   'mailto:https://myemail:[email protected]'

# The title field is totally optional
uptime | apprise -vv \
   'discord:https:///4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js'

Configuration Files

No one wants to put there credentials out for everyone to see on the command line. No problem apprise also supports configuration files. It can handle both a specific YAML format or a very simple TEXT format. You can also pull these configuration files via an HTTP query too! You can read more about the expected structure of the configuration files here.

# By default if no url or configuration is specified aprise will attempt to load
# configuration files (if present):
#  ~/.apprise
#  ~/.apprise.yml
#  ~/.config/apprise
#  ~/.config/apprise.yml

# Windows users can store their default configuration files here:
#  %APPDATA%/Apprise/apprise
#  %APPDATA%/Apprise/apprise.yml
#  %LOCALAPPDATA%/Apprise/apprise
#  %LOCALAPPDATA%/Apprise/apprise.yml

# If you loaded one of those files, your command line gets really easy:
apprise -vv -t 'my title' -b 'my notification body'

# If you want to deviate from the default paths or specify more than one,
# just specify them using the --config switch:
apprise -vv -t 'my title' -b 'my notification body' \
   --config=/path/to/my/config.yml

# Got lots of configuration locations? No problem, you can specify them all:
# Apprise can even fetch the configuration from over a network!
apprise -vv -t 'my title' -b 'my notification body' \
   --config=/path/to/my/config.yml \
   --config=https://localhost/my/apprise/config

Attaching Files

Apprise also supports file attachments too! Specify as many attachments to a notification as you want.

# Send a funny image you found on the internet to a colleague:
apprise -vv --title 'Agile Joke' \
        --body 'Did you see this one yet?' \
        --attach https://i.redd.it/my2t4d2fx0u31.jpg \
        'mailto:https://myemail:[email protected]'

# Easily send an update from a critical server to your dev team
apprise -vv --title 'system crash' \
        --body 'I do not think Jim fixed the bug; see attached...' \
        --attach /var/log/myprogram.log \
        --attach /var/debug/core.2345 \
        --tag devteam

Developers

To send a notification from within your python application, just do the following:

import apprise

# Create an Apprise instance
apobj = apprise.Apprise()

# Add all of the notification services by their server url.
# A sample email notification:
apobj.add('mailto:https://myuserid:[email protected]')

# A sample pushbullet notification
apobj.add('pbul:https://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b')

# Then notify these services any time you desire. The below would
# notify all of the services loaded into our Apprise object.
apobj.notify(
    body='what a great notification service!',
    title='my notification title',
)

Configuration Files

Developers need access to configuration files too. The good news is their use just involves declaring another object (called AppriseConfig) that the Apprise object can ingest. You can also freely mix and match config and notification entries as often as you wish! You can read more about the expected structure of the configuration files here.

import apprise

# Create an Apprise instance
apobj = apprise.Apprise()

# Create an Config instance
config = apprise.AppriseConfig()

# Add a configuration source:
config.add('/path/to/my/config.yml')

# Add another...
config.add('https://myserver:8080/path/to/config')

# Make sure to add our config into our apprise object
apobj.add(config)

# You can mix and match; add an entry directly if you want too
# In this entry we associate the 'admin' tag with our notification
apobj.add('mailto:https://myuser:[email protected]', tag='admin')

# Then notify these services any time you desire. The below would
# notify all of the services that have not been bound to any specific
# tag.
apobj.notify(
    body='what a great notification service!',
    title='my notification title',
)

# Tagging allows you to specifically target only specific notification
# services you've loaded:
apobj.notify(
    body='send a notification to our admin group',
    title='Attention Admins',
    # notify any services tagged with the 'admin' tag
    tag='admin',
)

# If you want to notify absolutely everything (reguardless of whether
# it's been tagged or not), just use the reserved tag of 'all':
apobj.notify(
    body='send a notification to our admin group',
    title='Attention Admins',
    # notify absolutely everything loaded, reguardless on wether
    # it has a tag associated with it or not:
    tag='all',
)

Attaching Files

Attachments are very easy to send using the Apprise API:

import apprise

# Create an Apprise instance
apobj = apprise.Apprise()

# Add at least one service you want to notify
apobj.add('mailto:https://myuser:[email protected]')

# Then send your attachment.
apobj.notify(
    title='A great photo of our family',
    body='The flash caused Jane to close her eyes! hah! :)',
    attach='/local/path/to/my/DSC_003.jpg',
)

# Send a web based attachment too! In the below example, we connect to a home
# security camera and send a live image to an email. By default remote web
# content is cached but for a security camera, we might want to call notify
# again later in our code so we want our last image retrieved to expire(in
# this case after 3 seconds).
apobj.notify(
    title='Latest security image',
    attach='http:/admin:password@hikvision-cam01/ISAPI/Streaming/channels/101/picture?cache=3'
)

To send more than one attachment, just use a list, set, or tuple instead:

import apprise

# Create an Apprise instance
apobj = apprise.Apprise()

# Add at least one service you want to notify
apobj.add('mailto:https://myuser:[email protected]')

# Now add all of the entries we're intrested in:
attach = (
    # ?name= allows us to rename the actual jpeg as found on the site
    # to be another name when sent to our receipient(s)
    'https://i.redd.it/my2t4d2fx0u31.jpg?name=FlyingToMars.jpg',

    # Now add another:
    '/path/to/funny/joke.gif',
)

# Send your multiple attachments with a single notify call:
apobj.notify(
    title='Some good jokes.',
    body='Hey guys, check out these!',
    attach=attach,
)

Want To Learn More?

If you're interested in reading more about this and other methods on how to customize your own notifications, please check out the following links:

Want to help Apprise get better?

About

Apprise - Push Notifications that work with just about every platform!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.7%
  • Roff 0.3%