onesignal
onesignal copied to clipboard
Add ability to pass additional parameters to create_notification api
@faressoft this should allow to pass additional parameters to the create_notification api
https://documentation.onesignal.com/reference#create-notification
for example headings ,subtitle,template_id...
Great, does this change allow also to pass segments and filters params ?
Can we create an extra argument instead, it seems a little bit complicated, like this:
- oneSignalIds (as first argument)
- message
- data
- params (Optional, extra OneSignal parameters for creating a notification)
We can break our api and release a new major release for this change.
@faressoft sounds good. The issue here is that the message can be optional because you can provide a template_id (that's the issue I ran into). Perhaps a better option here could be to introduce another method?
@mkuklis another method for what ? what are the arguments ? any suggestions for the methods names ?
@mkuklis how about allow sending template_id in the message argument:
message
- the notification message (String)
- template_id (Number)
- or contents (Object)
Do you think it is acceptable doing it that way ?
@faressoft One method for sending notifications with just a message like you had it before. And a new one which takes object with multiple parameters.
With your proposed API:
- oneSignalIds (as first argument)
- message
- data
- params (Optional, extra OneSignal parameters for creating a notification)
If I want to send a notification by template_id I would have to call:
createNotification([ids], null, data, {template_id: 'id'})
which is kind of complicated too.
@faressoft template_id is also a string so we won't be able to distinguish between message or template_id.
I second this change !