How to send batches of million push notifications using Amazon Simple Notification Service (SNS)

pimpreneil picture pimpreneil · Jun 20, 2014 · Viewed 10.5k times · Source

Like many companies, the one I work for isn't comfortable in using Apple's APNS: No official library, stream that get cut-off randomly, etc... The same goes for Android's push system: Limited to small batches, completely different to Apple's APNS... That's why we are looking for an alternative and when Amazon claimed to be able to send millions of push notifications almost for free, we thought that SNS would be the perfect solution.

The issue is that we frequently have more than one million devices to address, and obviously our push campaigns rarely target the same devices. As far as we dug, the only solution is to use the AWS API that only provides a method to create the endpoints one at a time! That is a big deal for us because after some testing, we figured that in order to create 1 000 000 endpoints, it would take approximately 15h (~17 calls/sec).

Even after all the endpoints are created, in order to send all the pushes at once, the endpoints need to be added to a topic, and again, this has to be done one endpoint at a time (so 15 more hours). Event if we multithreaded our calls to let's say 30 threads, it would still take an hour!

So, could anyone tell us if there is anything that we missed? Is Amazon really expecting us to flood their webservices during 30 hours in order to create one push campaign? How can they pretend to send a million pushes in a second if it takes hours to prepare it? Are they working on a batch API for SNS? Is it possible to plug an Amazon DB containing the tokens to feed an SNS topic?

Answer

Gdeglin picture Gdeglin · Jun 20, 2014

It looks like Amazon provides a few methods of adding endpoints/tokens, including a CSV importer (but limited to 2MB csv files at a time). They also provide an API and sample java application for bulk uploading tokens (link).

The topic subscription point is addressed by an Amazon SNS employee here, essentially explaining that there is no batch API available for this unfortunately.

There are a few other 3rd party push notification providers that may better meet your needs when it comes to frequently creating custom segments/topics:

  1. OneSignal (Disclosure: I run this company)
  2. MixPanel
  3. Parse