Amazon SNS Mobile Push - how to bulk subscribe end

2019-03-15 10:36发布

问题:

I am trying to move my existing iOS push notification infrastructure over to amazon SNS mobile push.

I exported all my tokens from my local db into an SNS application (using CSV). Now I want to send push notification to all my 10,000 users. I think the only way is to create a topic and subscribe all the users to that topic then publish message to that topic.

Is there any easy way to subscribe all the 10,000 users who I have imported into the system to a topic?

Thanks for any help!

回答1:

It sounds like you have created the Amazon SNS Platform Application and imported your tokens as Amazon SNS Platform Endpoints.

What kind of notification are you sending?

  • If you send a custom message to each user, use Direct Addressing. With this approach, you Publish to each EndpointARN.

  • If you send the same message to all users, use topics. You need to subscribe your endpoints to a topic. When you are ready to send, Publish to the TopicARN. Amazon SNS will handle delivery to all endpoints subscribed to that topic. Amazon SNS currently does not provide a bulk subscribe API, so you will have to invoke Subscribe once per EndpointARN.

Full disclosure: I work for AWS on Amazon SNS.



回答2:

Unfortunately there is no way so far... see Bulk push endpoints subscription to a topic on AWS Discussion Forum.

Hi there langelvicente,

Thanks for this feature request. I've passed this back through to the SNS Service Team for review.

Best regards, Phil P



回答3:

This is now possible with subscribing mobile endpoints to topics. The default subscriber limit was increased.

Q: Are there limits to the number of topics or number of subscribers per topic?

By default, SNS offers 10 million subscriptions per topic, and 3,000 topics per account. To request a higher limit, please contact us at at http://aws.amazon.com/support

http://aws.amazon.com/sns/faqs/?nc2=h_ls



回答4:

If you have an application full of endpoints which you want to bulk subscribe to a SNS topic you can do so from the AWS SNS dashboard by:

  1. Going to that application in SNS
  2. Waiting until the 'total items' count at the bottom has completed its count (ie all items are listed)
  3. Checking the select all check mark above the list of endpoints (screenshot attached)
  4. Tap on platform action > subscribe endpoints to topic
  5. Enter your topic ARN and click create subscription

The process will begin and it will stall your web browser but let it be as it takes time and if you want to see the subscriptions to the topic increasing you can use the AWS CLI with :

 aws sns get-topic-attributes --topic-arn "[YOUR TOPIC ARN]"

note the "SubscriptionsConfirmed" value



回答5:

Yes, but caveat: they each must accept your effort to enroll them into push messaging. That means that for each token in your database, each individual must consent to receiving future messages from you (via SMS and email, that is).

Each address (tel #, email) becomes an endpoint, and you can use SNS to create a topic, then subscribe each endpoint. After a confirmation email is sent to each endpoint (person on your list), they must confirm, in order to begin receiving your stream of messages via text or email.

Unfortunately, this confirmation/consent event is dicey, and must be handled correctly. Your ARN's title must be succinct (7 letter via SMS, no subject line allowed). Hence, you must contact them via SMS using a name they will recognize (the SMS message will arrive via short code, 304-something), and can be refused and/or blocked.

Not trivial! Best to investigate using push messages via mobile app. This will avoid the coveted SMS space, but you might consider putting out a blast to email and/or SMS, in order to get them using your mobile app. Apparently, given the immediacy of SMS, folks will be reading your first confirmation within 20 seconds. This could be a good thing, if they confirm, then accept your future messages.

Am doing this right now, and am preparing to be recognized by name using my initial blast -- apps that create anonymous SMS will be banned through iTunes!