How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

后端 未结 16 1504
南旧
南旧 2020-11-22 10:17

I\'m starting with the new Google service for the notifications, Firebase Cloud Messaging.

Thanks to this code https://github.com/firebase/quickstart-a

16条回答
  •  一个人的身影
    2020-11-22 10:51

    Works in 2020

    $response = Http::withHeaders([
                'Content-Type' => 'application/json',
                'Authorization'=> 'key='. $token,
            ])->post($url, [
                'notification' => [
                    'body' => $request->summary,
                    'title' => $request->title,
                    'image' => 'http://'.request()->getHttpHost().$path,
                    
                ],
                'priority'=> 'high',
                'data' => [
                    'click_action'=> 'FLUTTER_NOTIFICATION_CLICK',
                    
                    'status'=> 'done',
                    
                ],
                'to' => '/topics/all'
            ]);
    

提交回复
热议问题