We are using Amazon SNS to sent SMS to customers through API(PHP). The topic may have email subscriptions as well as SMS subscriptions. I.e While creating a subscription,protocol may be email/sms. But we want to sent only SMS while publishing the messages. Email subscriptions should not receive any message. How to archive this?
This is not possible. All subscribers to the topic will be sent the message.
You can provide different versions of messages for different types of subscriptions (eg SMS vs email), but you cannot control which type of subscriber receives a message.
Some alternatives:
Maintain separate topics for situations where you wish to send a notification only to a subset of subscribers
Use Amazon Pinpoint to specifically target mobile users with notification campaigns
Related
I send messages using SES api, set up topics in SNS for email delivery notifications.
I also use an SQS queue to put delivery notifications in there. Everything works for me, but I would like to have different queues for different email senders.
I assume that this can be done using a filter in Amazon SNS on a subscription that puts notifications in the SQS queue, but I can’t figure out how to do it and is it even possible for email delivery notifications, because I don’t send them, but Amazon itself, it’s unknown what are the attributes of the message sent to the SNS.
We have different environments that all use same SES to send emails. We are looking for a way to filter the delivery notifications that SES sends back to the topic we have created so that they end up in the correct SQS of each environment.
We tried adding a header to the message but unfortunately SNS topic filter only works with message attributes that we have no control over when SES publishes the delivery notification. How can we achieve this? How can we filter delivery notifications by original environment that has sent the email?
When I publish to a topic it hits ALL subscribers ALWAYS?
I have a topic with several subscriptions, sometimes I want to publish a message to just one of those subscriptions.
Is there a way to do this or do I need to create another topic and have the subscription in 2 topics? In that case I'm bugging the user (assuming this use case is to message users) twice right?
Yes -- when a message is sent to an Amazon SNS topic, all subscribers receive the message.
If you wish to contact a specific subscriber, your code will have to contact them directly (eg via email).
Amazon SNS also has the ability to send an SMS message to one or more recipients without using an SNS Topic. So, if your desired recipients are on SMS, this is a simple task.
I am successfully sending emails using the AWS SDK for Java and I can also retrieve the Message ID for each email. Now I need to track the email to see if it was successfully delivered or it bounced.
Is there a way to use that Message ID to track the status of a specific email?
I have explored the getSendStatistics API but this only gives statistics for all emails, ideally I need something to track individual emails.
Is there a way to track individual emails using an SES API or even a Simple Notification Service API?
You can use Amazon SES Notifications through Amazon SNS for that. You create SNS topic subscriptions depending how you want to track the deliveries and bounces.
The SNS notification content itself contains a mail object that has the message ID, a delivery object for successful deliveries, a bounce object for bounced recipients and a complaint object for complained recipients (if any).
I am sending many messages but the subscribers change very often (per message), how can can i choose my specific subscribers on every message? the number of possibilities is too much to create topic to each combination.
You can't. A message is delivered to all subscribers of the SNS topic.
Once you subscribe an endpoint to a topic and the subscription is
confirmed, the endpoint will receive all messages published to that
topic. Source
You can manage the endpoints yourself on the back end. You then publish to an individual endpoint. For large groups you will have to build in flood protection.