15

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!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
user348398
  • 511
  • 2
  • 7
  • 17

5 Answers5

16

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.

Rohan Deshpande
  • 3,535
  • 1
  • 26
  • 31
  • 1
    Each topic has a limit of 10.000 subscribers. What is the best way to handle this situation since i don't want to register the same tokens in multiple topics (some users will receive then multiple push when i send notification to all topics) – Peacemoon May 06 '14 at 12:42
  • Why can't you use Direct Addressing? – Rohan Deshpande May 09 '14 at 06:46
  • I can use Direct Addressing when writing my own workers to send to million users. In this case I would send million requests to Amazon Server. I find Topic is a better way to send general push to multiple users because i must send only 1 request to Amazon Server. I wish that Amazon can handle this use case. – Peacemoon May 09 '14 at 08:58
  • I'm unclear on what you are asking for since it seems that Topics already address your scenario. Could you provide more details about your use case? I'd be happy to help you figure out an optimal approach. – Rohan Deshpande May 12 '14 at 05:01
  • 1
    In my app, i register the device token every time the app starts. This device token will be added automatically in a Topic. Imagine a user A is already registered in Topic 1. Topic 1 now has more than 10.000 users so that i have to create Topic 2. Now user A starts the app again and my app registers the token again to my backend (now in Topic 2).Now user A has his token both in my Topic 1 and Topic 2. When i send push to both Topic 1 and 2, the user A will receive 2 identical Push.I can not check if token is registered because there is no search api for Topic.Hope you understand my explanation – Peacemoon May 12 '14 at 16:23
  • 7
    As stated in the FAQ to SNS: "By default, SNS offers 10 million subscriptions per topic, and 3,000 topics per account." So I think the problem with 10000 is gone. – Stas Zhukovskiy Sep 16 '14 at 22:01
  • 2
    Hi @RohanDeshpande, is there any news about when will this feature be available? – Barbaros Alp Aug 19 '15 at 08:26
  • @RohanDeshpande -- Is confirmation of an SNS topic subscription required in all cases? This creates a cumbersome, non-standard flow for mobile app (e.g. iOS) push notifications. Can this be handled programmatically? – ericpeters0n Jun 15 '16 at 20:42
  • 2
    @ericpeters0n mobile endpoints [do not need to be confirmed](http://stackoverflow.com/questions/26376492/amazon-sns-sdk-invalid-parameter-exception-on-subscription-confirmation/26385693#26385693). – Rohan Deshpande Jun 16 '16 at 03:58
0

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

Community
  • 1
  • 1
yukinarit
  • 45
  • 7
0

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

Cagatay Gurturk
  • 7,186
  • 3
  • 34
  • 44
0

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

enter image description here

Zigglzworth
  • 6,645
  • 9
  • 68
  • 107
  • Does it really work? I've done this so we got 30k+ arns and tried to subscribe in a topic. after the Create subscription I checked the tab Topic and see if the arn subscribed count is same with the item count in the Application Tab. But seems I need to do it multiple times (Create subscription) to subscribe all the endpoint. The increase in subscription in each process is like 200-500 endpoint. Can someone confirm? – rubberdont Aug 18 '17 at 04:10
  • It works. I did it with over 40k but i did it with around 2k at a time. Not 40k in one hit – Zigglzworth Aug 18 '17 at 06:54
  • This is not working for me. I don't see the option to select all endpoints... maybe AWS changed its UI in the meantime? – ehzicamesmo Jun 01 '20 at 18:44
-1

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!