laravel-notification-channels / onesignal

OneSignal notifications channel for Laravel
MIT License
283 stars 119 forks source link

Additional API parameters #16

Closed chancezeus closed 6 years ago

chancezeus commented 7 years ago

I'm wondering if it would be possible (and within the scope of this plugin) to add functionality for setting ios badge information and/or other additional API parameters (content_available, subtitle, attachments) when sending a notification. Maybe through a setParameter/addParameter function (or a __call fluent syntax where ->ios_badgeType sets the badge parameter)...

murshid1988 commented 7 years ago

Any update on this?

aliwesome commented 7 years ago

@chancezeus you can send data (key,value) by using setData function in OneSignalMessage class, here is an example:

public function toOneSignal($notifiable)
    {
        return OneSignalMessage::create()
            ->subject($subject)
            ->body($body)
            ->url($url)
            ->setData('show_notification',true);
    }
chancezeus commented 7 years ago

@aliwesome that only adds "custom" data not api properties like ios_badgeType, I requested the ability to add (custom) api properties (and this also ensures that even when the rest api is updated, this package supports everything, instead of only functionality that is available in the latest release).

murshid1988 commented 7 years ago

I just used the example provided here for PHP as a temporary workaround.