AWS SNS response handling - java

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

Related

AWS SES auditing

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.

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

i want to send notification to my all authenticated app user

I have an application that contains order data . I want to send this to all users of this app as notification.My target is to send Push Notifications to all of the users of my applications. How would I accomplish that?
To begin with your app mush already be using GCM and listening to the correct topic. Otherwise you have to roll out an update with the new GCM feature and hope that all users update it.
If you want to see some code for this take a look at this sample i crated some time ago. What you need to implement from the sample is the "SubscribeTopic" part. And to test if its working you can use this java program.
The good thing about topics is that you don’t need to save the users registration tokens and the message is sent to everyone listening for that exact topic.
Use Apache kafka
The original use case for Kafka was to be able to rebuild a user
activity tracking pipeline as a set of real-time publish-subscribe
feeds. This means site activity (page views, searches, or other
actions users may take) is published to central topics with one topic
per activity type. These feeds are available for subscription for a
range of use cases including real-time processing, real-time
monitoring, and loading into Hadoop or offline data warehousing
systems for offline processing and reporting.
To start with, note that a full GCM implementation requires both a client implementation and a server implementation. Before you can write client apps that use GCM, you must have an application server that meets the following criteria:
Able to communicate with your client.
Able to send properly formatted requests to the GCM connection
server.
Able to handle requests and resend them using exponential back-off.
Able to securely store the API key and client registration tokens.
Note: never include the API key in any client code.
For XMPP, the server must be able to generate message IDs to uniquely
identify each message it sends (GCM HTTP connection server generates
message IDs and returns them in the response). XMPP message IDs
should be unique per sender ID.
Complete documentation, how-to-guides for sending messages and links to examples can be found from Cloud Messaging - Messaging Concepts and Options.
You may also check ANDROID AND GCM – BROADCAST YOURSELF for the tutorial and demonstration on the use of GCM for the broadcast of messages to an Android client from a Tomcat server and use of sending broadcastintents from a service and receiving those broadcastintents from an app's activity.

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