AWS SES auditing - java

I need to maintain the status in the database if the email was delivered successfully or not, if the user has actually received the email or not,
when was the email delivered, email contents etc. for the purpose of auditing. How to do this ? Is there any API for this in AWS sdk ?

Its not as simple as just turning it on, but AWS does provide all the pieces you will need. This is how I do it currently
Turn on AWS delivery notifications, which will send the notifications to an SNS topic
Have that SNS topic delivery those messages to an SQS queue
Have a background job processing those messages and move them to a DynamoDB database for permanent storage.
The key part is #1, how you handle #2 and #3 is up to you - if I had to do it again I would use Lambda to takeover #3 for me, instead of using a custom job running on a dedicated Ec2 instance.
You can find out more about delivery notifications here:
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/configure-sns-notifications.html#configure-feedback-notifications-console
also keep in mind, the tracking is not perfect - no email tracker is - SES uses some of the same techniques that mailchimp/constant contact use to determine if an email was opened, but it is far from foolproof.

You can configure Amazon SES to notify an Amazon SNS topic when you receive bounces or complaints, or when emails are delivered. Amazon SNS notifications are in JavaScript Object Notation (JSON) format, which enables you to process them programmatically.
Follow the steps :
Create topic in SNS
Subscribe to topic for delivery notifications(notifications are
pushed to AWS SNS topic in JSON format).
Subscribe to SNS in one of the following way:
Lambda
SQS
HTTP/S
Email
SMS
Considering the requirement of saving the JSON parameters in db table for purpose of auditing, you can listen to HTTP/S or SQS.
JSON response will have useful information like message id, notification type like complaints, bounce, delivery etc.

Related

AWS SNS response handling

Am new to implement AWS SNS SMS gateway for my Java program. After the successful publishing message to AWS, I would like to know is the message send or not? Its always giving a response with messageId even the message fails to send. Is there any specific method or API to expose for this?
From the SNS FAQ:
Q: How do I track the delivery status of my SMS messages?
By enabling the Delivery Status feature in Amazon SNS, you can get information on the following for each message: MessageID, Time Sent, Destination Phone Number, Disposition, Disposition Reason (if applicable), Price, and Dwell Time.
In other words from the docs:
Amazon Simple Notification Service (Amazon SNS) provides support to log the delivery status of push notification messages. After you configure application attributes, log entries will be sent to CloudWatch Logs for messages sent from Amazon SNS to mobile endpoints. Logging message delivery status helps provide better operational insight, such as the following:
* Know whether a push notification message was delivered from Amazon SNS to the push notification service.
* Identify the response sent from the push notification service to Amazon SNS.
* Determine the message dwell time (the time between the publish timestamp and just before handing off to a push notification service).
Reference, check for code examples:
https://docs.aws.amazon.com/sns/latest/dg/sns-msg-status.html
So it seems you're up to using cloudwatch for this. The messageid you get from the API will of course be useful to filter for the information.
I suggest that you open a ticket for AWS support (because of your further questions as comments):
For professional support I suggest to open a case with them: https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&limitType=service-code-sns-text-messaging

Logback: send email via AWS SNS on error

I am using logback in our java application for logging.
I want to send emails via AWS SNS whenever I encounter an error in my logs.
How can I do it for SNS?
Do I have to write a custom appender for it?
Yes. you will have to write a custom appender.
And also make sure that the email id to whom you want to send the email to, should first subscribe to the SNS topic. With SNS you cannot send emails to arbitrary email IDs that are not subscribed to the topic

Amazon SNS with java, Send group SMS to all over the world

I am trying to integrate send promotional SMS messages to customers. For this can I use amazon SNS, and can I integrate this SNS with my web application?
I am using java and I want send group SMS with one click in my web application.
Also, is there any better solution rather than Amazon SNS?
Amazon SNS can send messages via SMS. Sending options are:
Send a message to a single recipient, or
Subscribe multiple recipients to an SNS topic, then send the message to the SNS topic. All subscribers will receive the message.
If you wish to send a different message to each recipient, use the first option. If you are regularly sending a message to the same group of recipients, use the second option. However, if the group of recipients frequently changes, it may be easiest to send each message individually.
See documentation: Sending SMS Messages with Amazon SNS

aws push notifications for multiple devices

I am using aws sns for sending push notifications to devices(mobile devices mostly android). I am able to send notifications to individual devices but i want to publish a common message that has to be sent to all the active devices. I have created platform application and created the end points using all the device registration ids and also created the topic and subscribed to it but when i publish the message, the publish is success and i get the message id but i am not getting the notifications. I have implemented most of the methods which are in AmazonSNSClient class. If someone can guide me it would be very helpful.
Check the aws console in the website using your credentials there you will find details of the notifications sent. If you find that the notification is sent then probably the notification has failed. AWS does not guarantee the delivery of notifications.

How to use AWS SQS and SNS to send notification message to website?

I have an email system in my website and as of now there is no way to show notification to user in my website. Until unless user login to email client they will not come to know that they have received a message.
Can i accomplish this with the help of AWS SQS and SNS? As this a website, there are many registered user. They will be sending message to any user and say when the recipient of the email is active & logged into the website, i need to display a notification. If user is offline, i just need to show these messages on header of the page when they login. How can i do this?
I tried creating message queue in AWS console(SQS) and Subscribed Queue to SNS Topic from SQS management console. I can try sending message to this queue but i am not sure how to distribute unique user related message as notification?
Please let me know if you have any suggestions for this?
I am using JAVA
Neither SNS nor SQS are good candidates for your use case. I would recommend putting the message in some kind of data store and querying that data store on page load to determine if you should display the notification.
Options include:
A SQL database (if you already have one, otherwise this is a pricy option)
DynamoDB (highly available and very fast, but kind of expensive option)
SimpleDB (highly available, kind of slow, and can't handle much throughput, good query capability, cheap)
S3 (highly available, kind of slow, high throughput, poor querying capabilities, cheapest option)
If you are not wed to the AWS stack you can take a look at Azure Table which probably meets your needs slightly better than any of those.

Categories