caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
10.9k stars 384 forks source link

Onesignal notifications do not work with a template, but without a body (+custom_data support) #1146

Open phantom943 opened 1 week ago

phantom943 commented 1 week ago

:mega: Notification Service(s) Impacted Onesignal

:lady_beetle: Describe the bug Apprise does not send Onesignal notifications without a body and does not support custom arguments. Some services, like Onesignal, support sending notifications with templates. When a template ID is provided - it is not required (and even not recommended) to pass message body. The message is taken from the template body message, and is then templated using custom data provided in the request (see Onesignal documentation, search for "custom_data"). Currently, Apprise refuses for work in this framework (it both does not accept None as body and does not accept custom_data in Onesignal requests). It also should not override title with "Apprise Notifications".

:bulb: Screenshots and Logs

import apprise

apobj = apprise.Apprise()
apobj.add("onesignal://template_id:app_id@api_key/player_id")
res = apobj.notify(body=None)
print(res)

The code above returns False indicating an internal error, and notifications are sent. It should return True, and result in a successful notification with template's message body and title. Also, it should accept a custom_data object.

:computer: Your System Details: