onesignal icon indicating copy to clipboard operation
onesignal copied to clipboard

Add ability to pass additional parameters to create_notification api

Open mkuklis opened this issue 8 years ago • 8 comments

@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...

mkuklis avatar Jan 06 '17 21:01 mkuklis

Great, does this change allow also to pass segments and filters params ?

faressoft avatar Jan 06 '17 22:01 faressoft

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 avatar Jan 06 '17 22:01 faressoft

@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 avatar Jan 06 '17 22:01 mkuklis

@mkuklis another method for what ? what are the arguments ? any suggestions for the methods names ?

faressoft avatar Jan 06 '17 22:01 faressoft

@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 avatar Jan 06 '17 22:01 faressoft

@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.

mkuklis avatar Jan 06 '17 22:01 mkuklis

@faressoft template_id is also a string so we won't be able to distinguish between message or template_id.

mkuklis avatar Jan 06 '17 22:01 mkuklis

I second this change !

fbatiga avatar Feb 20 '17 12:02 fbatiga