ap·prise / verb
To inform or tell (someone). To make one aware of something.
Apprise Transactions aims to enable push Notifications for just about every payment platform with just about every notification service
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).
Business owners who wish to receive notifications for payments no longer need to develop a custom notification system for each and every new payment platform or notification service as they appear. They can use this one script to standardize how transactions are received across payment platforms.
Developers who wish to build applications that accept payments can more easily integrate a range of payment platforms. JSON formatted requests can be sent to notification services, such as Amazon SNS or a custom endpoint, for further processing. Everything is already wrapped and supported within the apprise transaction notify script that ships with this product.
Supported Notifications
This project is dependent on Apprise for notifications.
Please see the official Apprise wiki for a full list of services that are supported.
Supported Payment Platforms
The table below identifies the platforms 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.
Payment Platform | Status | Dependent Services | Default Port |
---|
Monero | Implemented (Stable) | monerod / monero-wallet-rpc | (TCP) 18081 / (TCP) 18082 |
Square | Planned | Square, Inc. | (TCP) 443 |
Installation
The easiest way is to install this package is from pypi:
pip install apprise-transactions
Command Line
A small command line tool is also provided with this package called apprise-transactions. 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:
Note: The command line tool is intended to be executed once per transaction.
monero-wallet-rpc --wallet-file ~/mywallet --disable-rpc-login --rpc-bind-port 18088 --prompt-for-password \
--tx-notify "/usr/bin/apprisetransactions --payment_provider Monero --tx_id %s \
--urls tgram://1034520651:CCCFjiawu448agga4TI_Bu3oolct1Qrxasdjf --debug --get_tx_details \
-s 0 -b You%20have%20received%20%7Bamount%7D%20%7Bcurrency%7D%2C%20which%20is%20currently%20worth%20%24%7Bamount_in_usd%7D \
-t Congrats%20incoming%20payment%20from%20%7Bpayment_provider%7D"
apprisetransactions --payment_provider Monero --tx_id testsdiajetestasjdftestasdjf --urls tgram://1043520651:CCCFjiawu448agga4TI_Bu3oolct1Qrxasdjf
monero-wallet-rpc --tx-notify ""
which apprisetransactions
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions --payment_provider Monero \
--tx_id %s --urls tgram://1043520651:CCCFjiawu448agga4TI_Bu3oolct1Qrxasdjf"
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions \
--payment_provider Monero --tx_id %s \
--urls mailto://userid:password@example.com?smtp=mail.example.com&from=noreply@example.com&name=no%20reply,pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b"
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions \
--payment_provider Monero --tx_id %s \
--urls mailto://userid:password@example.com?smtp=mail.example.com&from=noreply@example.com&name=no%20reply \
--get_tx_details \
--body You%20have%20received%20%7Bamount%7D%20%7Bcurrency%7D%2C%20which%20is%20currently%20worth%20%24%7Bamount_in_usd%7D"
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions \
--payment_provider Monero --tx_id %s \
--urls mailto://userid:password@example.com?smtp=mail.example.com&from=noreply@example.com&name=no%20reply \
--get_tx_details \
--body {recipient}"
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions \
--payment_provider Monero --tx_id %s \
--urls json://user:password@hostname:port \
--get_tx_details \
--get_raw_data"
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions --payment_provider Monero \
--tx_id %s --urls tgram://1043520651:CCCFjiawu448agga4TI_Bu3oolct1Qrxasdjf \
--security_level 10"
Configuration Files
To request further transaction details requests are made to a server. By default localhost will be used.
Optionally server configuration can be stored in a file.
monero-wallet-cli --tx-notify "/usr/bin/apprisetransactions \
--payment_provider Monero --tx_id %s \
--urls pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b \
--server_config /etc/apprise/server.cfg"
Attaching Files
Apprise also supports file attachments too! Specify as many attachments to a notification as you want.
monero-wallet-rpc --tx-notify "/usr/bin/apprisetransactions \
--payment_provider Monero --tx_id %s \
--urls discord:///4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js \
-attach https://siasky.net/fAOAieEJvZ0FegbcZMPWAtbKKscdUKXCimkjtv6uHKW9-A"
Developers
To send a notification from within your python application, just do the following:
from apprisetransactions.factories import MoneroFactory
from apprisetransactions.transactions import MoneroTransaction
from apprisetransactions.configuration import ServerConfig
from apprisetransactions import settings
from apprisetransactions.settings import BlockchainSecurity
settings.init()
settings.security_level = BlockchainSecurity.IN_A_BLOCK
transaction_factory = MoneroFactory(server_config_file='server.cfg')
transaction: MoneroTransaction = transaction_factory.get_transaction(
tx_id='asdf',
get_tx_data=True,
get_raw_data=True,
)
urls = ['pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b']
body = 'Transaction received: {tx_id}'
title = 'Transaction incoming from {payment_provider}'
attach = 'https://siasky.net/fAOAieEJvZ0FegbcZMPWAtbKKscdUKXCimkjtv6uHKW9-A'
apprise_result = transaction.notify(
urls=urls, body=body, title=title, attach=attach
)
if apprise_result is False:
logging.error('Apprise failed to complete notification')
Attaching Files
Attachments are very easy to send using the API:
apprise_result = transaction.notify(
urls=urls, body=body, title=title, attach='/local/path/to/my/DSC_003.jpg'
)
To send more than one attachment, you just need the AppriseAttachment object:
from apprise import AppriseAttachment
attachments = AppriseAttachment()
attachments.add('https://i.redd.it/my2t4d2fx0u31.jpg?name=FlyingToMars.jpg')
attachments.add('/path/to/funny/joke.gif')
apprise_result = transaction.notify(
urls=urls, body=body, title=title, attach=attachments
)
Want To Learn More?
Want to add a payment provider?
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: