The sendFcmMessage
method sends a message to Firebase Cloud Messaging using the v1 API. The target can be a condition, a token or a topic.
registerToFCM
function.import { sendFcmMessage } from '@aracna/fcm';
import GOOGLE_SERVICE_ACCOUNT from './google-service-account.json';
const message = {
token: 'YOUR_FCM_TOKEN'
};
sendFcmMessage(GOOGLE_SERVICE_ACCOUNT, message)
.catch(() => {})
.then((message) => {
console.log(message);
});