I using sns of aws to send sms, when I log cloudwatch i see:
{
"notification": {
"messageId": "ac8d8d02-491d-58bf-ace8-xxxxxx",
"timestamp": "2021-01-01 00:03:54.576"
},
"delivery": {
"phoneCarrier": "Viettel",
"mnc": 4,
"numberOfMessageParts": 1,
"destination": "+843293xxxxx",
"priceInUSD": 0.0525,
"smsType": "Transactional",
"mcc": 452,
"providerResponse": "Message has been accepted by phone carrier",
"dwellTimeMs": 361,
"dwellTimeMsUntilDeviceAck": 2604
},
"status": "SUCCESS"
}
But in my phone, I don't get any message, How I fix it?
For several countries, senders are required to use a pre-registered alphabetic sender ID.
To request a sender ID from AWS Support, file a support request. Some countries require senders to meet specific requirements or abide by certain restrictions in order to obtain approval.
In these cases, AWS Support might contact you for additional information after you submit your sender ID request.
For further information about this, you can read this docs.
Related
I am trying to send SMS through AWS SNS. Message body includes a URL to the webpage for user invite.
Messages work for Australia but when I send similar message to New Zealand, it fails.
If I remove URL from message body, SMS is sent otherwise it fails.
Here is the AWS cloudwatch log
{
"notification": {
"messageId": "..........",
"timestamp": "2021-10-25 14:18:44.002"
},
"delivery": {
"numberOfMessageParts": 1,
"destination": "+64........",
"priceInUSD": 0.12146,
"smsType": "Transactional",
"providerResponse": "Phone is currently unreachable/unavailable",
"dwellTimeMs": 1011,
"dwellTimeMsUntilDeviceAck": 3192
},
"status": "FAILURE"
}
Looking through AWS forums it says that one one the possibilities for this response can be invalid message body.
Interestingly if I add https://google.com in message body, SMS is sent.
I encountered the same issue. All of a sudden all of our SMS failed to send (our texts include a link). I tried sending various links all failed to send; however, www.google
I tried sending sms with amazon sns and I got
SMS message published to phone number +23481XXXXXXX successfully.
Message "ID": *********************
But the message status show "fail".
Please is there any other thing I have to do after verifying my account before I start sending sms?
You might also want to check if the region you're using supports sms and if the country you're trying to send has support.
https://docs.aws.amazon.com/sns/latest/dg/sns-supported-regions-countries.html
Not sure if this is just SNS related or if you're trying to send sms after an account was created in cognito, might want to check region support for that too
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-email-phone-verification.html
You can activate Delivery status logging to obtain a more-detailed log for SMS messages.
From Viewing Amazon CloudWatch metrics and logs for SMS deliveries - Amazon Simple Notification Service:
Activate Delivery status logging
Send a message
View the results in Amazon CloudWatch Logs
Here is an example log entry:
{
"notification": {
"messageId": "1077257a-92f3-5ca3-bc97-6a915b310625",
"timestamp": "2016-06-28 00:40:34.559"
},
"delivery": {
"mnc": 0,
"destination": "+1XXX5550100",
"priceInUSD": 0.00645,
"smsType": "Transactional",
"mcc": 0,
"providerResponse": "Unknown error attempting to reach phone",
"dwellTimeMs": 1420,
"dwellTimeMsUntilDeviceAck": 1692
},
"status": "FAILURE"
}
I'm trying to send sms confirmation messages with Amazon SNS to the phones of users who sign up for an account using cognito and verify their phone numbers. My cognito user pool is located at us-east-2 and I recently got my spend limit increased to $50 for both us-east-1 and us-east-2. I tested sending sms messages through the sns console to my phone and that works perfectly. However, I don't get the sms messages when trying to verify users on cognito. When checking the sns console, it looks like the only successful messages that are being sent to my phone were my manual sent messages from the console and everything else has failed. Any help would be greatly appreciated.
I have found that the error comes for my specific phone number as a sprint carrier and get the following log failed response:
{
"notification": {
"messageId": "5dab56f3-2dd3-5a6d-b96e-0e96904d334b",
"timestamp": "2020-12-29 23:27:26.712"
},
"delivery": {
"phoneCarrier": "SPRINT Spectrum L.P.",
"mnc": 880,
"numberOfMessageParts": 1,
"destination": "+1******3252",
"priceInUSD": 0.00645,
"smsType": "Transactional",
"mcc": 311,
"providerResponse": "Blocked as spam by phone carrier",
"dwellTimeMs": 202,
"dwellTimeMsUntilDeviceAck": 1254
},
"status": "FAILURE"
}
However, I tested with an AT&T phone and TMobile phone and they get the messages delivered successfully with the following log response:
{
"notification": {
"messageId": "3106a00c-40de-53ce-9f40-f869fc025013",
"timestamp": "2020-12-29 23:24:12.183"
},
"delivery": {
"phoneCarrier": "T-mobile USA Inc.",
"mnc": 800,
"numberOfMessageParts": 1,
"destination": "+1******1131",
"priceInUSD": 0.00645,
"smsType": "Transactional",
"mcc": 310,
"providerResponse": "Message has been accepted by phone",
"dwellTimeMs": 238,
"dwellTimeMsUntilDeviceAck": 601251
},
"status": "SUCCESS"
}
This error is really weird to me as there should be no reason why SPRINT blocks my phone from getting sms messages from aws sns on cognito only but other phone services allow getting messages. I also still am able to get messages from the SNS console but only cognito fails to send with the carrier blocking it. Any help would be greatly appreciated!
Since you are able to receive SNS SMS from AT&T and T-Mobile phone carrier, I would strongly suggest that you contact AWS Premium Support to help you identify why SMS sent to SPRINT Spectrum L.P. are not being delivered.
after the usual hair pulling efforts, I finally made AWSSimple Email Service push notifications to my REST end point through SNS and successfully applied the required business logic on those recipients.
Points:
You must be pushing multiple emails to that Recipient that's why more than one (unique) bounce notifications are being pushed by SNS.
Yes. And every notification has its own "messageId"
But why I am getting bounce Notifications for single recipient repeatedly, only, why not other wrong recipients.?
Response/s is attached:
{
"notificationType": "Bounce",
"bounce": {
"bounceType": "Permanent",
"bounceSubType": "Suppressed",
"bouncedRecipients": [
{
"emailAddress": "abc.xyz.aws#gmail.com",
"action": "failed",
"status": "5.1.1",
"diagnosticCode": "Amazon SES has suppressed sending to this ..."
}
],
"timestamp": "2017-12-28T07:06:37.106Z",
"feedbackId": "010101609bef62ff-0f30cac8-ec3c-41f3-9eee-5f7d90ef3c46-000000",
"reportingMTA": "dns; amazonses.com"
},
"mail": {
"timestamp": "2017-12-28T07:03:44.000Z",
"source": "abcXYZ#gmail.com",
"sourceArn": "arn:aws:ses:com-xyz-9:9696845301:identity/abcXYZ#gmail.com",
"sourceIp": "10.eee.ppq.lmn",
"sendingAccountId": "12365498512",
"messageId": "010101609bf1b35c-889e815e-b84c-4b08-a283-ee5f3e9740f2-000000",
"destination": ["abc.xyz.aws#gmail.com"]
}
}
Another one and all others:
{
"notificationType": "Bounce",
"bounce": {
"bounceType": "Permanent",
"bounceSubType": "Suppressed",
"bouncedRecipients": [
{
"emailAddress": "abc.xyz.aws#gmail.com",
"action": "failed",
"status": "5.1.1",
"diagnosticCode": "Amazon SES has suppressed sending to this ..."
}
],
"timestamp": "2017-12-28T07:06:37.106Z",
"feedbackId": "010101609befa8f5-a41662a5-b84e-4048-bc3a-d1f1469c8f1a-000000",
"reportingMTA": "dns; amazonses.com"
},
"mail": {
"timestamp": "2017-12-28T07:04:05.192Z",
"source": "abcXYZ#gmail.com",
"sourceArn": "arn:aws:ses:com-xyz-9:9696845301:identity/abcXYZ#gmail.com",
"sourceIp": "10.eee.ppq.lmn",
"sendingAccountId": "12365498512",
"messageId": "010101609bef61bb-310b4f29-0b01-4ecd-b763-b295e26d0732-000000",
"destination": ["abc.xyz.aws#gmail.com"]
}
}
For further info:
HTTP end point is is Spring MVC based REST controller.
Searching:
Through searching I found these:
1- Duplicate delivery/bounce notifications being sent to my SNS topic?
2- Emails being sent multiple times - can I see AWS logs ?
Kindly can any one help/guide or point out what can be the issue?
Hope you people are having a great holiday season.
"bounceSubType": "Suppressed",
This recipient is on the global suppression list, which means no SES customer can send mail to this address. It also means that these bounces are handled differently and more quickly than some other kinds of bounces.
https://aws.amazon.com/blogs/ses/goodbye-blacklist-introducing-the-suppression-list/
The bottom line here is that this bounce is a red flag to you that you need to manage your recipient addresses more carefully. Continuing to send messages to recipients on the suppression list is a signal to AWS that you may not be monitoring your bounces, or that you may not really be sending messages to people who actually want to receive them... and that in turn could potentially lead to enforcement actions.
If the emails you send result in excessive bounces, complaints, or other issues, your sending abilities might be placed on probation or suspended. This process is called enforcement.
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/e-faq.html
The documentation for AWS SNS and SQS have sections about message attributes. But there is no explanation how to have SQS message attributes when that queue is subscribed to a SNS topic.
Is there a way to configure AWS SNS to add particular message attributes to the SQS messages send via the subscription?
From aws documentation:
To use message attributes with Amazon SQS endpoints, you must set the subscription attribute, Raw Message Delivery, to True. For more information about raw message delivery, see Appendix: Large Payload and Raw Message Delivery.
https://docs.aws.amazon.com/sns/latest/dg/SNSMessageAttributes.html
https://docs.aws.amazon.com/sns/latest/dg/large-payload-raw-message.html
Added an example from real-life project. Hopefully it helps to clarify things.
The message published to the sns topic is following:
aws sns publish --topic-arn arn:aws:sns:us-west-2:xxx:pollution-event --message '{"operatorId":3375001,"eventTypeId":1,"eventLevelId":1,"validFrom":"2018-03-10T09:00:00Z","validTo":"2018-03-11T09:00:00Z"}' --message-attributes '{"Type" : { "DataType":"String", "StringValue":"Orchestration.Services.Model.Pollution.PollutionMessage"}}'
Enable Raw Delivery is false (default). The message received by sqs contains only content, there are no attributes
{
"Type": "Notification",
"MessageId": "78d5bc6f-142c-5060-a75c-ef29b774ec66",
"TopicArn": "arn:aws:sns:eu-west-2:xxx:pollution-event",
"Message": "{\"validFrom\": \"2018-03-10T09:00:00Z\",\"validTo\": \"2018-03-11T09:00:00Z\",\"eventLevelId\": 1,\"eventTypeId\": 1,\"operatorId\": 3375001}",
"Timestamp": "2018-04-17T11:33:44.770Z",
"SignatureVersion": "1",
"Signature": "xxx==",
"SigningCertURL": "https://sns.eu-west-2.amazonaws.com/SimpleNotificationService-xxx.pem",
"UnsubscribeURL": "https://sns.eu-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-2:xxx",
"MessageAttributes": {
"Type": {
"Type": "String",
"Value": "Orchestration.Services.Model.Pollution.PollutionMessage"
},
"AWS.SNS.MOBILE.MPNS.Type": {
"Type": "String",
"Value": "token"
},
"AWS.SNS.MOBILE.MPNS.NotificationClass": {
"Type": "String",
"Value": "realtime"
},
"AWS.SNS.MOBILE.WNS.Type": {
"Type": "String",
"Value": "wns/badge"
}
}
}
Enable Raw delivery is true. The message contains the message attributes and proper content
Note: See other answer for better response, using Raw Message Delivery
While the Using Amazon SNS Message Attributes documentation sending Amazon SNS message attributes to Amazon SQS, it appears that the attributes are sent in the body of the message rather than being attached as message attributes on the resulting Amazon SQS messages.
For example, I did the following:
Created an Amazon SNS topic
Created an Amazon SQS queue and subscribed it to the SNS topic
Published a message to SNS
I published via the AWS Command-Line Interface (CLI):
aws sns publish --topic-arn arn:aws:sns:ap-southeast-2:123456789012:foo --message msg --subject subj --message-attributes '{"somename" : { "DataType":"String", "StringValue":"somevalue"}}'
(I got syntax help from map datatype in aws cli)
The resulting message in SQS showed the attributes as part of the message:
{
"Type" : "Notification",
"MessageId" : "53e3adad-723a-5eae-a7b7-fc0468ec2d37",
"TopicArn" : "arn:aws:sns:ap-southeast-2:123456789012:foo",
"Subject" : "subj",
"Message" : "msg",
"Timestamp" : "2017-05-29T12:48:22.186Z",
...
"MessageAttributes" : {
"somename" : {"Type":"String","Value":"somevalue"}
}
}
It would be much nicer if these attributes were attached to the SQS message as official SQS attributes. Alas, it seems this is not the case.
Enabled Raw message delivery type while adding SQS subscription for the topic inside SNS
If you are here because you have a SQS queue that is subscribed to an SNS topic, you checked that your subscription has set the Raw Message Delivery to True but you still cannot read an attribute on your SQS message:
Make sure that your SQS client is not filtering out message attributes.
The code below will only include myAttribute when receiving messages from the SQS queue:
SQS.receiveMessage({
QueueUrl: queueUrl,
VisibilityTimeout: 20,
WaitTimeSeconds: 10,
MessageAttributeNames: [
"myAttribute"
],
},...
If you want to read the value of some attribute other than myAttribute you will have to specify it (white list) or replace "myAttribute" with "All" to include all SQS attributes.
SQS.receiveMessage({
MessageAttributeNames: [
"myAttribute", "myOtherAttribute"
],
},...
Reference: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ReceiveMessage.html