Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there any way to send different badge count to different users in a same topic?

I have FCM integration in my Node.js project where I am sending number of notifications to the IOS users and I need to manage notification count i.e. Badge count which will be different across the devices but I am sending notification to a particular topic to which these devices are subscribed.

my Payload is :

    var payload = {
            notification: {
                title: "Title...",
                body: "Notification Body...",
                sound: "customeSound.caf",
                badge : "?"
            },
            data: {
                testData: "custom data"
            }
        },
topic = "topicName";

        admin.messaging().sendToTopic(topic, payload)
            .then(function (response) {
                // See the MessagingTopicResponse reference documentation for the
                // contents of response.
                console.log("Successfully sent message:", response);
            })
            .catch(function (error) {
                console.log("Error sending message:", error);
            });
    });
like image 317
aatif shaikh Avatar asked Nov 01 '25 00:11

aatif shaikh


1 Answers

All devices that are subscribed to the corresponding topic will receive the same payload you set.

You'll have to send a separate payload for each device. Or if applicable, maybe just group the ones with the similar badge value -- but that would require you to send to a group of tokens (using registration_ids) instead of sending to a topic.

like image 194
AL. Avatar answered Nov 03 '25 13:11

AL.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!