AWS Poinpoint 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,
}
}
以下是payload
使用上述设置发送APNS时获得的信息
["aps": {
alert = {
body = "TEST";
title = "Test message sent from Amazon Pinpoint.";
};
"content-available" = 1;
"mutable-content" = 0;
}, "data": {
pinpoint = {
deeplink = "https://www.example.com";
};
}]
如何"mutable-content": 1
通过AWS Pinpoint设置APNS?
没有文档,但是经过反复试验,这对我有用:
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创建有效负载的链接: