How do I keep mailing list recipients from unsubscribing everyone on the list from my Amazon SNS topic emails?

4 minuto de leitura
0

I subscribed the email address of a mailing list to my Amazon Simple Notification Service (Amazon SNS) topic. A member of the mailing list then unsubscribed the email address of the mailing list, along with everyone on the list.

Short description

When you publish messages to an Amazon SNS topic with email subscribers, the email message that the subscribers receive has a link to unsubscribe. A message near the link reads: "If you wish to stop receiving notifications from this topic, please click or visit the link below to unsubscribe."

When you subscribe to an Amazon SNS topic with your email address, choosing the link unsubscribes your email. When a member of an Amazon SNS topic mailing list chooses the unsubscribe link, the email address of the mailing list is unsubscribed. Then, everyone on the mailing list gets an "Unsubscribe Confirmation" message.

Note: Email spam filters can unsubscribe the email address of the mailing list.

To prevent the unsubscribe action, create a subscription that requires authentication to unsubscribe. This allows only the topic owner and subscription owner to unsubscribe. All other subscribers who choose the link receive the following error:

"Subscription not removed
Your subscription could not be removed because of an error. If you wish to unsubscribe but do not have AWS credentials, or have any other questions about Amazon SNS, please contact Amazon at sns-question@amazon.com."

Resolution

To replace an existing subscription with a subscription that requires authentication, delete the existing subscription. Then, use either of the following methods to set up the new subscription.

Important: You must have access to the subscription confirmation email message to confirm a new subscription and complete the setup. If you're subscribing a mailing list to your topic, then add your email address to the mailing list first to confirm the subscription.

Set up an email subscription that requires authentication to unsubscribe (Amazon SNS console)

1.    Open the Amazon SNS console, and then subscribe your email address to your topic.

2.    In your email, find the subscription confirmation message from AWS Notifications. The sender is often "no-reply@sns.amazonaws.com".

Important: Don't use the link in the subscription confirmation email to confirm the subscription.

3.    Copy the URL from the Confirm subscription link.

4.    In the navigation pane of the console, choose Subscriptions.

5.    On the Subscriptions page, select the subscription that's "Pending confirmation," and then choose Confirm subscription.

6.    In the Confirm subscription dialog, paste the subscription confirmation URL that you copied.

7.    Choose Confirm subscription.

Set up an email subscription that requires authentication to unsubscribe (AWS CLI)

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

1.    In the AWS CLI, run the following command:

aws sns list-topics --region us-east-1

Important: Replace region us-east-1 with the correct AWS Region for your topic.

2.    In the output, copy the TopicArn value of the topic that you want to subscribe to. The topic ARN looks similar to this example: arn:aws:sns:us-east-1:0123456789012:my-topic

3.    Run the following command:

aws sns subscribe --topic-arn arn:aws:sns:us-east-1:0123456789012:my-topic --protocol email --notification-endpoint test@amazon.com --region us-east-1

Important: Replace topic-arn with the topic ARN that you copied. Replace notification-endpoint with the email address that you want to subscribe to your topic. Replace region with your topic's Region.

4.    In your email, find the subscription confirmation message from AWS Notifications. The sender is often "no-reply@sns.amazonaws.com".

Important: Don't use the link in the subscription confirmation email to confirm the subscription.

5.    Copy the URL from the Confirm subscription link, paste the URL into a text editor, and then copy the token. The token is a long series of numbers and letters in the middle of the URL after "Token=" and before "&Endpoint=". It looks similar to this example:

https://sns.us-east-1.amazonaws.com/confirmation.html?TopicArn=arn:aws:sns:us-east-1:123456789012:my-topic&Token=2336412f37fb687f5d51e6e241da92fcfd03593fd8dfa4bd75978a2ad7255afb88e71028f6a034d06f469f6c7ef2
0a609348542a0c68a9561c03a39d59beb02e2b7112c45f7ae26c344819b39cf07f15bef6c6c09766f9caa1fa55c236e7
7c33a50870bc027c74640ff64a7e99a67117
&Endpoint=test@amazon.com

6.    Run the following command:

aws sns confirm-subscription --token 2336412f37fb687f5d51e6e241da92fcfd03593fd8dfa4bd75978a2ad7255afb88e71028f6a034d06f469f6c7ef20a609348542a0c68a9561c03a39d59beb02e2b7112c45f7ae26c344819b39cf07f15bef6c6c09766f9caa1fa55c236e77c33a50870bc027c74640ff64a7e99a67117 --topic-arn arn:aws:sns:us-east-1:0123456789012:my-topic --authenticate-on-unsubscribe true --region us-east-1

Important: Replace token with the token that you copied. Replace topic-arn with the topic ARN that you copied. Replace region with your topic's Region.

Related information

Getting started with Amazon SNS

subscribe (AWS CLI Command Reference)

confirm-subscription (AWS CLI Command Reference)

AWS OFICIAL
AWS OFICIALAtualizada há um ano
Sem comentários