Skip to content

Commit 927436f

Browse files
committed
Update README
1 parent d21bcc1 commit 927436f

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,27 @@ pushNotifications.send(tokens, notifications, (error, result) => {
418418
});
419419
```
420420

421-
`fcm_notification` - object that will be passed to FCM message notification field
421+
`fcm_notification` - object that will be **merged** with the notification fields. This allows you to override specific notification properties (like `channelId`, `ttl`, etc.) without duplicating standard fields like `title` and `body`.
422422

423-
Fcm object that will be sent to provider ([Fcm message format](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages?authuser=0#Message)) :
423+
For example, to set a channel ID for Android:
424+
```js
425+
const data = {
426+
title: 'My Title',
427+
body: 'My Message',
428+
fcm_notification: {
429+
channelId: 'my-channel-id'
430+
},
431+
custom: { id: 123 }
432+
};
433+
```
434+
435+
The `fcm_notification` object will be merged with the notification fields when building the FCM message:
436+
437+
```js
438+
notification: { ...builtNotification, ...data.fcm_notification }
439+
```
440+
441+
FCM object that will be sent to provider ([FCM message format](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages?authuser=0#Message)) :
424442

425443
```json
426444
{

0 commit comments

Comments
 (0)