This application is a generic application to handle notifications using UnifiedPush which can be used to test your setup. It is an example how to use the UnifiedPush library.
You can use this app as a rustic application to receive notifications send from a terminal/a process
Toggle OFF "WebPush" before registering on UP-Example, and send HTTP POST requests.
For instance with cURL:
curl -X POST $endpoint --data "title={Your Title}&message={Your Message}"
Toggle ON "WebPush" before registering on UP-Example, and send WebPush requests.
With a python script for instance:
#!/usr/bin/env python
from pywebpush import webpush
import urllib
import sys
if len(sys.argv) < 2:
print("Usage: {} message".format(sys.argv[0]))
subinfo = {
"endpoint": "YOUR_ENDPOINT_HERE",
"keys": {
"auth": "AUTH_SECRET_HERE",
"p256dh": "P256DH_SECRET_HERE"
}
}
message = "title=UP!&message=" + urllib.parse.quote(' '.join(sys.argv[1::]))
webpush(subinfo, message)
To use it: ./notify.py My message here
release_key
: keystore in base64release_store_password
: keystore passwordrelease_key_password
: key password, the key alias must beunifiedpush
codeberg_token
: codeberg token for package, withwrite:package
right (https://codeberg.org/user/settings/applications)