【发布时间】:2018-12-14 10:06:51
【问题描述】:
我是使用 AWS 服务编程的新手,所以一些基本的东西对我来说相当困难。最近,我被要求开发一个使用 Amazon Pinpoint 发送推送通知的应用程序,作为考虑未来实施的测试。
正如您在我在这里发布的另一个问题 (Amazon Pinpoint and Ionic - Push notifications not working when app is in background) 中看到的,当我的应用在后台运行时,我在尝试向用户发送推送通知时遇到了麻烦。该应用是使用 Ionic 开发的,关注 these steps。
当我快要放弃的时候,我决定尝试直接通过 Firebase 发送推送,终于成功了。一些研究将我带到this question,其中另一位用户将问题描述为仅发生在 AWS 控制台中,因此解决方案是使用 CLI。经过一番搜索,我找到了this tutorial about how to sending pinpoint messages to users using CLI,这似乎就是我想要的。将它与this documentation about phonegap plugin 结合,我能够生成一个我认为可能是解决方案的 JSON:
{
"ApplicationId":"io.ionic.starter",
"MessageRequest":{
"Addresses": {
"": {
"BodyOverride": "",
"ChannelType": "GCM",
"Context": {
"": ""
},
"RawContent": "",
"Substitutions": {},
"TitleOverride": ""
}
},
"Context": {
"": ""
},
"Endpoints": {"us-east-1": {
"BodyOverride": "",
"Context": {},
"RawContent": "",
"Substitutions": {},
"TitleOverride": ""
}
},
"MessageConfiguration": {
"GCMMessage": {
"Action": "OPEN_APP",
"Body": "string",
"CollapseKey": "",
"Data": {
"": ""
},
"IconReference": "",
"ImageIconUrl": "",
"ImageUrl": "",
"Priority": "High",
"RawContent": "{\"data\":{\"title\":\"sometitle\",\"body\":\"somebody\",\"url\":\"insertyourlinkhere.com\"}}",
"RestrictedPackageName": "",
"SilentPush": false,
"SmallImageIconUrl": "",
"Sound": "string",
"Substitutions": {},
"TimeToLive": 123,
"Title": "",
"Url": ""
}
}
}
}
但是当我在 cmd 中使用 aws pinpoint send-messages --color on --region us-east-1 --cli-input-json file://test.json 执行它时,我得到了响应 An error occurred (NotFoundException) when calling the SendMessages operation: Resource not found。
我认为我没有正确编写 JSON 文件,因为这是我第一次这样做。所以,如果你们中的任何人知道我做错了什么,无论我误解了哪一步,我都将不胜感激!
【问题讨论】:
标签: amazon-web-services cordova ionic-framework push-notification