我已设法设置firebase云功能以向主题发送通知.问题是它发送给所有用户,包括发件人,我如何设置我的云功能,以便它不向发送者显示通知?请帮忙?以下是我发送给主题的方式
exports.sendNotesNotification = functions.database.ref('/Notes/{pushId}')
.onWrite(event => {
const notes = event.data.val();
const payload = {
notification: {
username: notes.username,
title: notes.title,
body: notes.desc
}
}
admin.messaging().sendToTopic("New_entry", payload)
.then(function(response){
console.log("Successfully sent notes: ", response);
})
.catch(function(error){
console.log("Error sending notes: ", error);
});
});
Run Code Online (Sandbox Code Playgroud)