can we schedule push notification using davibennun/laravel-push-notification

120

Question: can we schedule push notification using davibennun/laravel-push-notification

my question is can we schedule push notification using davibennun/laravel-push-notification or by using firebase php sdk, one solution is queues and cron jobs etc but i just want know that is it there any way we can just pass a paramenter schedule_at etc to notification config and our notification scheduled at that time,this is how i am sending push now

                $result = $push->setService('fcm')->setMessage([                     'mutable_content' => true,                     'notification' => [                             'title'=> $title,                             'body'=> $push_message,                             'sound' => 'default',                             "icon" => "new",                             "content_available" => true,                             'data' =>  $metadata,                             'type' => 'basic'                         ],                         'data' => [                             'title'=> $title,                             'message'=> $push_message,                             'sound' => 'default',                             "icon" => "new",                             'metadata' => $metadata,                             'type' => 'basic',                             'data' =>  $metadata,                         ],                     ])                     ->setDevicesToken($users_devices_chunk)                     ->send()                     ->getFeedback(); 

Total Answers: 1

89

Answers 1: of can we schedule push notification using davibennun/laravel-push-notification

I think there is no approach to schedule notification by the Firebase php error but there is two way you can do it:

  1. Send notifications as data and control the time of action by your clients.
  2. Use the cronjob or delayed dispatching.

The delayed dispatching adds delay time to the jobs before the process:

SendNotificationJob::dispatch($data)->delay(now()->addMinutes(10));