Closed kyagie closed 3 months ago
There's not enough information here to go off. Can you please try and debug further.
Check what message the channel is passing off because it's sent to the Firebase package. Or use the Firebase package directly and see if the issue persists.
That looks like you're using an older version of the library?
Using v4.3
Sorry - someone else had commented on the issue just before with a screenshot of code that looked old. Looks like they have deleted it so perhaps not relevant to the issue you have.
I can see that the FcmMessage
is correctly turned into a Kreait
message under the hood - so it does seem that the notification information is being sent correctly to Firebase.
Without more information or a reproduction there's not much I can do here.
Here is an example of the notification body received by devices from my remote server. However the request body only has null values. All values are shown the remoteMessage body however.
{ "notification": { "request": { "content": { "autoDismiss": true, "sound": "default", "data": null, "body": null, "sticky": false, "badge": null, "title": null, "subtitle": null }, "trigger": { "remoteMessage": { "originalPriority": 2, "notification": { "usesDefaultVibrateSettings": false, "visibility": null, "notificationPriority": null, "titleLocalizationArgs": null, "clickAction": null, "color": null, "eventTime": null, "link": null, "usesDefaultSound": false, "channelId": null, "lightSettings": null, "title": "Image Request", "imageUrl": null, "vibrateTimings": null, "tag": null, "localOnly": false, "bodyLocalizationArgs": null, "titleLocalizationKey": null, "ticker": null, "usesDefaultLightSettings": false, "sticky": false, "body": "Please provide an image for billboard: Acacia Road (Acacia area)", "sound": null, "icon": null, "notificationCount": null, "bodyLocalizationKey": null }, }
Here is function to dispatch notifications
` /**
Create a new notification instance. */ public function __construct( public string $title, public string $body ) { // }
/**
@return array<int, string> */ public function via(object $notifiable): array { return [FcmChannel::class]; }
public function toFcm($notifiable): FcmMessage { return (new FcmMessage(notification: new FcmNotification( title: $this->title, body: $this->body ))); } `
How can I change my code to have the notification data for body and title be present in the request body as well?