Skip to content

Commit 6d1fb4a

Browse files
committed
Update README
1 parent a356291 commit 6d1fb4a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,27 @@ pushNotifications.send(tokens, notifications, (error, result) => {
580580
});
581581
```
582582
583-
`fcm_notification` - object that will be passed to
583+
`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`.
584584
585+
For example, to set a channel ID for Android:
585586
```js
586-
new gcm.Message({ ..., notification: data.fcm_notification })
587+
const data = {
588+
title: 'My Title',
589+
body: 'My Message',
590+
fcm_notification: {
591+
channelId: 'my-channel-id'
592+
},
593+
custom: { id: 123 }
594+
};
595+
```
596+
597+
The `fcm_notification` object will be passed to
598+
599+
```js
600+
new gcm.Message({ ..., notification: { ...builtNotification, ...data.fcm_notification } })
587601
```
588602
589-
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)) :
603+
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)) :
590604
591605
```json
592606
{

0 commit comments

Comments
 (0)