This is the development environment. Use a Webhook the app registered with this server.
Python
Use only the standard library, with no extra dependencies.
Set BREEZE_SERVER to https://push.breezelabs.dev and store your key as the environment secret BREEZE_WEBHOOK_KEY.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError
server = os.environ['BREEZE_SERVER'].rstrip('/')
key = os.environ['BREEZE_WEBHOOK_KEY']
payload = json.dumps({'title': 'Job complete', 'message': 'Processing has finished', 'thread_id': 'jobs'}).encode('utf-8')
request = Request(server + '/v1/send', data=payload, method='POST', headers={
'Authorization': 'Bearer ' + key,
'Content-Type': 'application/json',
})
try:
with urlopen(request, timeout=20) as response:
status, result = response.status, json.load(response)
except HTTPError as error:
status, result = error.code, json.load(error)
print({'status': status, 'request_id': result.get('request_id'), 'data': result.get('data')})
if status != 200:
raise RuntimeError('Inspect the Breeze result before retrying')
The caller must also decide how to handle a network timeout or disconnection. Neither proves that the notification was not sent.