fcm icon indicating copy to clipboard operation
fcm copied to clipboard

how to Subscribe token to topic

Open yunoos321 opened this issue 3 years ago • 1 comments

how to Subscribe token to topic add send notification large number of users

I'am using for setTopic

public function toFcm($notifiable)
    {
        return FcmMessage::create()
            ->setData(['type' => $this->screen, 'user_id' => (string)$notifiable->id])
            ->setTopic('promotion')
            ->setNotification(\NotificationChannels\Fcm\Resources\Notification::create()
                ->setTitle($this->title)
                ->setBody($this->messages)
                ->setImage('http://example.com/url-to-image-here.png'))
            ->setAndroid(
                AndroidConfig::create()
                    ->setFcmOptions(AndroidFcmOptions::create()->setAnalyticsLabel('analytics'))
                    ->setNotification(AndroidNotification::create()->setColor('#0A0A0A'))
            )->setApns(
                ApnsConfig::create()
                    ->setFcmOptions(ApnsFcmOptions::create()->setAnalyticsLabel('analytics_ios'))
            );
    }

yunoos321 avatar Feb 03 '22 18:02 yunoos321

https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html#topic-management

ankurk91 avatar Feb 08 '22 14:02 ankurk91