我有一个订阅了 SNS 主题的 SQS 队列。当我向该主题发布新通知时,我使用以下代码(在 Sinatra 应用程序中):
jsonMessage = {
"announcement" => {
"first_name" => results['first_name'][:s],
"last_name" => results['last_name'][:s],
"loc_code" => results['location'][:s],
"note" => params['note_content']
}
}
msgid = @announcments_topic.publish(jsonMessage.to_json,
{subject: "Note Created",
message_structure: 'json' })
Run Code Online (Sandbox Code Playgroud)
当我的队列侦听器收到此通知时,相应散列的消息部分如下所示:
"Message"=>"{\"announcement\":{\"first_name\":\"Eve\",\"last_name\":\"Salt\",\"loc_code\":\"Location\",\"note\":\"test\"}}"
Run Code Online (Sandbox Code Playgroud)
在我的队列侦听器中,我想使用这个哈希,但是当我尝试使用
JSON.parse(result['Message'])
Run Code Online (Sandbox Code Playgroud)
由于转义的双引号,我收到了意外的令牌错误。关于如何解决这个问题的任何建议?我没有以 JSON 格式正确发送我的通知吗?如何让 sns/sqs 不转义双引号?
我正在尝试注册我的Android设备以接收推送通知,但亚马逊服务器返回错误,说它无法找到我的PlatformApplicationArn.我使用他们的sdk设置它,但它似乎没有找到它.
这是错误:AWS错误消息:无效参数:PlatformApplicationArn原因:没有必需参数的值
这是发送它的代码:
String platformApplicationArn = "arn:aws:sns:us-east-1:897955111111:app/GCM/com.myapp";
AWSCredentials awsCredentials = new BasicAWSCredentials("XXXXXXXX", "XXXXXXXXXXXXXXXXXXXXX");
pushClient = new AmazonSNSClient(awsCredentials);
CreatePlatformEndpointRequest createPlatformEndpointRequest = new CreatePlatformEndpointRequest();
String customPushData = "my custom data";
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
platformEndpointRequest.setCustomUserData(customPushData);
platformEndpointRequest.setToken(pushNotificationRegId);
platformEndpointRequest.setPlatformApplicationArn(platformApplicationArn);
CreatePlatformEndpointResult result = pushClient.createPlatformEndpoint(createPlatformEndpointRequest);
Run Code Online (Sandbox Code Playgroud) I'm having trouble getting Amazon SNS to send a subscription message to my HTTPS endpoint. The CloudWatch logs report the following:
{
"delivery": {
"deliveryId": "7bdda6a5-0000-5d6d-b0c0-e9b254fde521",
"destination": "https://www.beta.yogacentre.com/webhooks/sns",
"providerResponse": "SSLPeerUnverifiedException in HttpClient",
"dwellTimeMs": 63661,
"attempts": 4
},
"status": "FAILURE"
}
Run Code Online (Sandbox Code Playgroud)
It looks like it doesn't like the SSL certificate I'm using, but I confirmed that the root CA is on the list SNS checks. Chrome reports my connection uses TLS 1.2, so it should be compatible with the recent end …
是否可以通过我们能够解析或参与的 SNS(在一天中的特定时间发送)安排我们的推送通知?
我搜索了 AWS 文档并浪费了几个小时,但找不到使用 Node JS 发送推送通知的 API 和代码。有人可以帮助在 Android 和 iOS 设备上使用 Node JS 发送 AWS SNS 推送通知吗?
push-notification amazon-web-services apple-push-notifications node.js amazon-sns
我正在尝试自定义当Elastic Beanstalk环境运行状况更改时发送的默认电子邮件
示例:当运行状况从“正常”过渡到“严重”时,会将一封电子邮件发送到该电子邮件地址(Elastic Beanstalk Environment-> configuration-> notification)
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.sns.html
我想编辑环境运行状况转变时出现的Notification的默认主题(在主题行中添加特定文本)。
我无法找到实现此目的的最佳方法,将不胜感激任何自定义电子邮件通知的指针。
我试图在用户请求重置密码时发送短信.我想等待发送消息以提醒用户是否成功.我目前正在尝试如下操作:
async function sendResetPasswordTextMessage(req, res) {
let result = {};
let phoneNumber = req.body.phoneNumber;
if (phoneNumber === undefined) {
return sendInvalidParametersMessage(res);
}
phoneNumber = phoneNumber.toString();
const userProfile = await models.UserProfile.findOne({
where: {
phoneNumber: phoneNumber
}
});
************************** RELEVANT CODE TO ISSUE *************************
if (userProfile) {
const message = "Your username is:\n" + userProfile.username;
const sent = await AWSSNSClient.sendMessage(message, phoneNumber);
if (!sent) {
result.error = setTitleAndMessage("Error", "An error occurred");
} else {
result.success = setTitleAndMessage("Success", "Message sent");
}
}
return res.send(result); …Run Code Online (Sandbox Code Playgroud) 通过 boto3 订阅 SNS 主题时,我没有在 SQS 队列中收到任何消息。
这是我使用的代码或 API 凭据的问题吗?与此账户关联的 IAM 策略具有 AWS PowerUser 权限,这意味着它可以不受限制地访问管理 SNS 主题和 SQS 队列。
当我通过 AWS 控制台创建等效结构(创建主题、创建队列、订阅主题队列)并使用 boto3、AWS CLI 或 AWS 控制台发送消息时,消息正确传递。
我不认为这是代码的问题,因为SubscriptionArn正确返回了?
我在 US-EAST-1 和 AP-SE-1 区域都尝试过这个,结果相同。
示例代码:
#!/usr/bin/env python3
import boto3
import json
def get_sqs_msgs_from_sns():
sqs_client = boto3.client('sqs', region_name='us-east-1')
sqs_obj = boto3.resource('sqs', region_name='us-east-1')
sns_client = boto3.client('sns', region_name='us-east-1')
sqs_queue_name = 'queue1'
topic_name = 'topic1'
# Create/Get Queue
sqs_client.create_queue(QueueName=sqs_queue_name)
sqs_queue = sqs_obj.get_queue_by_name(QueueName=sqs_queue_name)
queue_url = sqs_client.get_queue_url(QueueName=sqs_queue_name)['QueueUrl']
sqs_queue_attrs = sqs_client.get_queue_attributes(QueueUrl=queue_url,
AttributeNames=['All'])['Attributes']
sqs_queue_arn = sqs_queue_attrs['QueueArn']
if …Run Code Online (Sandbox Code Playgroud) Lambda L1 订阅了 SNS S1。
L1 每次调用都会返回状态码和消息
我可以在每次独立调用 L1 响应时检查它,但是当我通过向 S1 发布消息来调用 L1 时,如何验证从 L1 返回的消息?
我需要在 java 中以编程方式执行此操作.. 任何指针表示赞赏
我已经创建了一个SNS主题,并且希望使用与嵌套属性匹配的过滤器策略来订阅它。例如,给出如下消息:
{
"foo": {
"bar": "baz"
},
"quux": "vorp"
}
Run Code Online (Sandbox Code Playgroud)
我只想匹配的bar属性foo等于的邮件baz。
到目前为止,我发现的文档仅提及在顶层指定的匹配属性。我对嵌套属性感兴趣。出于这个问题的目的,让我们假设我不控制消息的结构。
amazon-sns ×10
amazon-sqs ×2
node.js ×2
android ×1
async-await ×1
aws-lambda ×1
aws-sdk-js ×1
boto3 ×1
https ×1
java ×1
javascript ×1
json ×1
moengage ×1
python ×1
ruby ×1
ssl ×1
tls1.2 ×1