1
votes

I configured FCM with my Node server. and I need to add firebase cloud messaging. and I can send messages successfully. I receive

projects/<project-name>/messages/<some random number as message id>

as the output.

but all the data messages I sent are not visible firebase console cloud-messaging section. I need those for analytics. to check how many people receive my message etc.

const message = {
  data: {
    ...args.data
  },
  topic
  // token
}

const messageResponse = await userFirebase.messaging().send(message);

I checked their documentation and unable to find how to set an analytics label with messaging. I am using firebase-admin V8.12.1

Java does have a message builder to set this analytics label. How can I do the same thing with nodeJs?

1

1 Answers

2
votes

found that we can set the analytics label under fcmOptions.

  const message = {
        data: {
          ...args.data
        },
        topic,
        fcmOptions: {
          analyticsLabel: "my_analytics_label"
        },
      };