laravel-notification-channels / onesignal

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

Is it possible to send a notification using a template_id? #75

Closed dyegonery closed 5 years ago

dyegonery commented 6 years ago

Hey guys. I've been trying to use this channel to send push notifications, but I really don't want to specify the headings of all my notifications, since I have all this setup on the Onesignal dashboard, with templates. I would like to send the notifications using the templates, like this:

return OneSignalMessage::create()
            ->setParameter('template_id', 'hash')
            ->setParameter('include_player_ids', 'push_userid')
            ->url(AutoLoginService::generateUrl($push_url, $notifiable->id));

When I try to run this, I always get the same error:

 Client error: `POST https://onesignal.com/api/v1/notifications` resulted in a `400 Bad Request` resp  
  onse:                                                                                                 
  {"errors":["Notification headings must not be null for any languages."]}    

It seems that this error is related with me not filling the subject of each notification. Is there a way for me to send the notifications using the templates?

Regards!

LKaemmerling commented 5 years ago

Closed because of inactivity. Feel free to reopen the issue when your problem is not fixed.