Skip to content

Latest commit

 

History

History
39 lines (35 loc) · 679 Bytes

README.md

File metadata and controls

39 lines (35 loc) · 679 Bytes

Hemera FCM

Plugin for Firebase Cloud Messaging

Examples

Setup

const FCM = require('hemera-fcm');
// Code...
hemera.use(FCM, { credentials: require('./google-services') });

Send notification

hemera.act({
	cmd: "CMD_SEND_DEVICE" || "CMD_SEND_TOPIC" || "CMD_SEND_GROUP",
	topic: "TOPIC_FCM",
	id: ["id-1", "id-2", "..."], 
	payload: {
		data: {},
		notification: {
			title: "...",
			body: "...",
		},
	},
}, function() {})

Subscribe / Unsubscribe to chanel

hemera.act({
	cmd: "CMD_SUBSCRIBE" || "CMD_UNSUBSCRIBE",
	topic: "TOPIC_FCM",
	payload: {
		client: "...",
		topic: "...",
	},
}, function() {})