如何使用 Javascript(或打字稿)Firebase Admin SDK 向数据消息添加分析标签?

How do I add an analytics label to data messages with the Javascript (or typescript) Firebase Admin SDK?

我想在message.And中设置标签 我看了官方文档here and similar question

但是我想不出在javascript中怎么写。

我的代码在这里:

const message = {
    notification: {
        title: "myTitle",
        body: "myBody"
    },
    condition: "!('TopicA' in topics)",
    AnalyticsLabel : "mylabel"             <=== something like this?
};
const response = await admin.messaging().send(message);

这是诀窍...

const message = {
    notification: {
        title: "myTitle",
        body: "myBody"
    },
    condition: "!('TopicA' in topics)",
    fcmOptions: {
        analyticsLabel : "MyLabel"
    }
};