我已经使用由火力地堡功能触发火力地堡云端通讯(FCM)成功发送通知:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const fs = require('fs');
admin.initializeApp();
exports.testNotif = functions.https.onRequest((request, response) => {
const mySecretNumber = getRandomInt(147)
var payload = {
notification: {
title: `You got a new Message`,
body: `My highest break ${mySecretNumber}`,
badge: mySecretNumber.toString(),
sound: `notif1.aiff`,
}
};
const ackString = `All done ${mySecretNumber}`;
console.log(ackString)
response.send(ackString);
//send to all topic
admin.messaging().sendToTopic(`all`, payload)
});
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
正如你可以看到我发送通知到一个名为“所有”的话题。
在火力控制台,您可以发送通知给观众,你可以创建。 在我来说,我已经创建了基于来自分析模块的用户属性不同的受众。
是否有可能也可以通过火力地堡功能发送通知给观众?