Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@novu/fcm): use message instead of body for data-type notifications #4652

Merged
merged 4 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions providers/fcm/src/lib/fcm.provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ test('should trigger fcm data for ios with headers options', async () => {
key_2: 'val_2',
title: 'Test',
body: 'Test push',
message: 'Test push',
},
});
});
Expand Down Expand Up @@ -278,6 +279,7 @@ test('should trigger fcm data for android with priority option', async () => {
key_2: 'val_2',
title: 'Test',
body: 'Test push',
message: 'Test push',
},
});
});
Expand All @@ -296,6 +298,7 @@ test('should clean the payload for the FCM data message', async () => {
object: '{"asd":"asd"}',
title: 'Test',
body: 'Test push',
message: 'Test push',
};

await provider.sendMessage({
Expand Down
7 changes: 6 additions & 1 deletion providers/fcm/src/lib/fcm.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ export class FcmPushProvider implements IPushProvider {
delete (options.overrides as { type?: string })?.type;
res = await this.messaging.sendMulticast({
tokens: options.target,
data: { ...payload, title: options.title, body: options.content },
data: {
...payload,
title: options.title,
body: options.content,
message: options.content,
},
...(androidData ? { android: androidData } : {}),
...(apnsData ? { apns: apnsData } : {}),
...(fcmOptionsData ? { fcmOptions: fcmOptionsData } : {}),
Expand Down
Loading