SNS; How to get valid SubscriptionARN after user confirmation

System: Windows, C#, Visual Studio 2015, AWSSDK.SimpleNotificationService

Using AWS-SNS, after creating a topic I add a subscription to the topic as follows;

var response = SnsClient.Subscribe(topicArn, "email", email);
var subscriptionArn = response.SubscriptionArn;

Initially, my subscription ARN is set to "pending confirmation" - presumably until the user confirms their subscription via email. I would have thought that calling subscribe again with the same email subsequent to confirmation would have returned a vilid ARN, but it doesn't seem to work that way.

Not having the subscription ARN prevents me from later unsubscribing an email from a subscription group. I'm sure there is a way to overcome it short of requiring the user to copy / past the email token into my application - but I can't seem to find it.

Thank you in advance.

SteveJ

(PS. I should note that the answer need to be C# specific - just a generic approach to the problem using their SDK or web API is fine.)


The Amazon SNS Subscribe documentation says:

The following element is returned by the service:

SubscriptionArn

The ARN of the subscription, if the service was able to create a subscription immediately (without requiring endpoint owner confirmation).

Therefore, it appears that an Email subscription only receives an ARN when the subscription has been confirmed .

You will need to identify the subscription (once subscribed) by calling ListSubscriptionsByTopic , looking for the Endpoint that matches the desired email address . You could then extract the ARN and use it when calling Unsubscribe .

链接地址: http://www.djcxy.com/p/5528.html

上一篇: 亚马逊SES:处理投诉通知的程序?

下一篇: SNS; 如何在用户确认后获得有效的SubscriptionARN