0.0.1 • Published 6 years ago

hemera-fcm v0.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

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() {})