Amazon SNS - Sending SMS, delivery status - amazon-web-services

I am trying to send messages using Amazon SNS but it's showing atypical behavior. It sends messages to some of the numbers while may or may not to others.
import boto3
client = boto3.client('sns', .....)
client.publish(PhoneNumber, Message)
I am using the publish API to directly send SMS for OTPs without using Topics. Is there a way I can get the delivery status for them? Would region/DND affect the delivery. This is for Indian numbers. I am using Transactional messages for the same.

On the console there is 'Text Messaging Preferences'. One needs to set up, IAM role for CloudWatch Logs access and Report Storage bucket. Once they are set up, Amazon will start storing logs in CloudWatch. Once done it will start showing delivery rates and status in the console UI and detailed logs in CloudWatch.
There are multitudes of reason for which delivery may fail. It lists out all on them. DND can also affect the delivery even if message type is transactional.
Also there is a availalble API to query these logs accordingly.

Related

AWS Cloudwatch alarms repeated notifications to slack

I'm successfully deployed solution described in AWS blog that enables repeated notifications on CloudWatch Alarms utilizing the alarm’s state change event via Amazon EventBridge and AWS Step Function.
There is a site which describe this:
https://github.com/aws-samples/amazon-cloudwatch-alarms-repeated-notification-cdk
It is able to send valid e-mail notifications, but the problem is to send it to Slack channel. I was overwhelmed by the problem of an incorrect message format being sent to a slack channel.
I'm looking for solution which can send repeated notification to Slack or how to change that code.

Getting Logs from GCP Alerting

I am setting up alerting for GCP VMs. It works fine for email, but I'm trying to use the webhook option. It shows the incident was caught and the webhook triggered. But I don't see an alert on the receiving end. I don't know how to debug since GCP webhooks seems like a blackbox. Does anybody know where I can see the log for the actual webhook call? I'm not sure it is receiving an alert ID from the webhook call.
I'm using this document:
https://cloud.google.com/monitoring/alerts/using-channels-api#api-create-channels
Thanks!
Gary
You configure a webhook notification channel and expect to be notified when incidents occur, but you might not receive any notifications because of following reasons:
1.Private endpoint
You can't use webhooks for notifications unless the endpoint is public.
To resolve this situation, use Pub/Sub notifications combined with a pull subscription to that notification topic.
When you configure a Pub/Sub notification channel, incident notifications are sent to a Pub/Sub queue that has Identity and Access Management controls. Any service that can query for, or listen to, a Pub/Sub topic can consume these notifications. For example, applications running on App Engine, Cloud Run, or Compute Engine virtual machines can consume these notifications.
2.Public endpoint
To identify why the delivery failed, examine your Cloud Logging log entries for failure information.
For example, you can search for log entries for the notification channel resource by using the Logs Explorer, with a filter like the following:
resource.type="stackdriver_notification_channel"
NOTE : Also check whether you have been mentioned in the recipient list, if not mentioned you will not be able to see the alert on the receiving end.
Refer Troubleshooting Alerting policies for information.

Amazon SES using Message Id

Im using AWS Lambda for sending emails by Amazon SES.
Each time that the request send_email succeeds I got the message id like confirmation.
But now, I want to use somehow this messageId. For example to know if this message concretelly get delivered or bounced.
CloudWatch offers me metrics, with the number of delivered or bounced messages but I want to look throught each one.
¿Is there any statement that allows to know the state of a message by id?
Due to the asynchronous nature of SMTP and how mails are being routed, you can't have this information immediately when sending an e-mail (via SES or otherwise).
However, AWS provides a feedback system which notifies an SNS topic when a message is delivered, bounced, or a complaint was received.
While the documentation is very detailed, the general idea is that you subscribe your own lambda(s) to the configured SNS topic(s) and you can then handle these events as you see fit (i.e. persist data on DynamoDB, call your unsubscribe API and so on).

Email status in AWS SES

I want to track emails that are being send by SES. I want to check if the email I am sending to my client is delivered or not. I found that AWS C# sdk provides the statistics, but it doesn't provide statistics per email address.
From Monitor email sending using Amazon SES event publishing - Amazon Simple Email Service:
To enable you to track your email sending at a granular level, you can set up Amazon SES to publish email sending events to Amazon CloudWatch, Amazon Kinesis Data Firehose, or Amazon Simple Notification Service based on characteristics that you define.
You can track several types of email sending events, including sends, deliveries, opens, clicks, bounces, complaints, rejections, rendering failures, and delivery delays. This information can be useful for operational and analytical purposes. For example, you can publish your email sending data to CloudWatch and create dashboards that track the performance of your email campaigns, or you can use Amazon SNS to send you notifications when certain events occur.

How do i send the SMS message using Amazon SNS

I can't able to send the Text messages using Amazon Simple Notification Services(SNS). I have tried with API and Amazon Console. Both are not working. Please help me to solve the issues.
I am using Amazon Free plan account.
Amazon Sns support two diffrent type of messages
Promotions message
Transaction message
If your mobile register do not disturb or many service provider not allowed promotions messages like Verizon
Map<String, MessageAttributeValue> smsAttributes =
new HashMap<String,MessageAttributeValue>();
smsAttributes.put("AWS.SNS.SMS.SMSType",new
MessageAttributeValue().withStringValue("Transactional").withDataType("String"))
To discover why an SMS message was not sent, you can enable logging in CloudWatch Logs.
From Viewing Amazon CloudWatch metrics and logs for SMS deliveries - Amazon Simple Notification Service:
You can collect information about successful and unsuccessful SMS message deliveries by enabling Amazon SNS to write to Amazon CloudWatch Logs. For each SMS message that you send, Amazon SNS will write a log that includes the message price, the success or failure status, the reason for failure (if the message failed), the message dwell time, and other information.
I did this recently to discover why my SMS was not successful. The message said that my carrier refused the message. I discovered that this was because I was using a Custom Sender ID. Once I removed that setting, I could successfully send SMS messages.