async function sendPushNotifications(snapshot) {
//...
var numSent = 0;
await Promise.all(messageBatches.map(async (messages) => {
const response = await admin.messaging().sendEachForMulticast(messages);
numSent += response.successCount;
}));
await snapshot.ref.update({
status: "succeeded",
num_sent: numSent
});
}
The Messaging.sendMulticast() function, previously used for sending batch notifications in the Firebase Admin SDK, is now deprecated. If you're still using this function in your applications, you need to update your code. Firebase now recommends using Messaging.sendEachForMulticast(), which is a more modern and efficient alternative.