fcm-push-notifications
v2.0.0
Published
FCM push notifications
Downloads
4
Readme
Installation
npm i --save fcm-push-notifications
Usage
import {
AndroidMessagePriority,
FcmPushNotification,
IFCMResponse,
IFMCAndroidConfig,
} from 'fcm-push-notifications';
const notification = new FcmPushNotification(
'my-project-id',
'./credentials/google-services.json'
);
const androidOptions: IFMCAndroidConfig = {
collapse_key: 'COLLAPSE_KEY',
priority: AndroidMessagePriority.HIGH,
data: {
prop1: 'Prop 1',
prop2: 'Prop 1',
},
notification: {
title: 'notification title',
body: 'notification body',
icon: 'https://banner2.cleanpng.com/20191013/tat/transparent-ui-icon-notification-icon-bell-icon-5da3d1f3d32951.3009239215710172038649.jpg',
color: '#ff0000',
tag: 'CUSTOM_TAG',
},
};
notification
.send({
message: {
token:
'my-registration-token',
android: androidOptions,
},
})
.then((response: IFCMResponse) => {
console.log('response', response);
});
References
For more information, please refer to the following documentation: