【问题标题】:AWS Pinpoint: Set APNS "mutable-content": 1AWS Pinpoint:设置 APNS“可变内容”:1
【发布时间】:2020-12-15 17:22:23
【问题描述】:

AWS Point APNS 默认设置为"mutable-content": 0

我正在使用 Node.js。

下面的工作正常,但mutable-content 始终是0"mutable-content": 0:

var messageRequest = {
'Addresses': {
https://forums.aws.amazon.com/: {
'ChannelType': channelType
}
},
'MessageConfiguration': {
'APNSMessage': {
'Action': action,
'Body': message,
'Priority': priority,
'SilentPush': silent,
'Title': title,
'TimeToLive': ttl,
'Url': url,
}
}

以下是使用上述设置发送 APNS 时得到的payload

["aps": {
alert = {
body = "TEST";
title = "Test message sent from Amazon Pinpoint.";
};
"content-available" = 1;
"mutable-content" = 0;
}, "data": {
pinpoint = {
deeplink = "https://www.example.com";
};
}]

如何通过 AWS Pinpoint 为 APNS 设置 "mutable-content": 1

【问题讨论】:

  • 有同样的问题。你知道怎么做吗?

标签: amazon-web-services apple-push-notifications aws-pinpoint


【解决方案1】:

没有文档,但经过一些试验和错误后,这对我有用:

var payload = {
    "aps": {
        "alert": {
            "title": "Bold text in the notification",
            "body": "Second line in the notification"
        },
        "sound": "default",
        "mutable-content": 1
    }
};

var messageRequest = {
    Addresses: {
        [token]: {
            ChannelType: "APNS",
        },
    },
    MessageConfiguration: {
        APNSMessage: {
            RawContent: JSON.stringify(payload),
        },
    },
};

只需将他们的模板替换为 RawContent 并像往常一样创建有效负载。可以参考苹果文档了解如何创建原始有效载荷。您也可以使用此方法调整内容可用密钥。以下是如何使用 json 创建有效负载的链接:

https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification

【讨论】:

    【解决方案2】:

    我知道这有点老了,但刚刚遇到这个问题并想分享我的解决方案。

    我发现将“MediaUrl”参数设置为非空字符串会导致 pinpoint 发送“mutable-content”:1

    我在任何精确文档中都没有看到这一点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多