From 8c057e9da11cc1ef1e44a72d455cc772596c2221 Mon Sep 17 00:00:00 2001 From: Taha Abdelmoutaleb Cherfia Date: Wed, 25 Oct 2023 13:40:25 +0200 Subject: [PATCH 1/2] fix(@novu/fcm): use message instead of body for data-type notifications --- providers/fcm/src/lib/fcm.provider.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/providers/fcm/src/lib/fcm.provider.ts b/providers/fcm/src/lib/fcm.provider.ts index f7274f84da4..2c036491cd7 100644 --- a/providers/fcm/src/lib/fcm.provider.ts +++ b/providers/fcm/src/lib/fcm.provider.ts @@ -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 } : {}), From 818c0c788c9ceee6a4f176c5cf8279d64a3ed26a Mon Sep 17 00:00:00 2001 From: Taha Abdelmoutaleb Cherfia Date: Thu, 26 Oct 2023 10:15:12 +0200 Subject: [PATCH 2/2] feat(@novu/fcm): update unit test --- providers/fcm/src/lib/fcm.provider.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/providers/fcm/src/lib/fcm.provider.spec.ts b/providers/fcm/src/lib/fcm.provider.spec.ts index 08321f545d2..3d56abe40a0 100644 --- a/providers/fcm/src/lib/fcm.provider.spec.ts +++ b/providers/fcm/src/lib/fcm.provider.spec.ts @@ -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', }, }); }); @@ -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', }, }); }); @@ -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({