Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

How to send to topic ?  #11

@cybersasi

Description

@cybersasi

I have no problem sending message to single device with user token, but now i need to send notification to a topic what should i do?

This is my code

use NotificationChannels\FCM\FCMMessageTopic;

.....
  public function toFCM($notifiable)
    {
        return (new FCMMessageTopic())
            ->to($this->topic)
            ->notification([
                'title' => 'Notification title',
                'body' => 'Notification body',
            ]);
    }

and it return this error

FatalThrowableError in FirebaseNotification.php line 43:
Call to undefined method NotificationChannels\FCM\Exceptions\InvalidArgumentException::notification()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions