1

I'm trying to send a basic APNS push notification to a specific APNS token using AWS SNS. All the examples I'm finding are how to store the token in SNS, subscribe to channels, and publish to channels.

I don't need that kind of usage with the application I'm building. The golang application decides which users a push needs to be sent to for which actions. Then it looks up the tokens for those users in the DB. All I need is a basic request to send a push notification to that token (preferably asynchronously).

Here is one of the examples I've looked at: http://docs.aws.amazon.com/sdk-for-go/api/service/sns/SNS.html#Publish-instance_method

mverderese
  • 5,314
  • 6
  • 27
  • 36

1 Answers1

2

To use the Publish action for sending a message to a mobile endpoint, such as an app on a Kindle device or mobile phone, you must specify the EndpointArn. The EndpointArn is returned when making a call with the CreatePlatformEndpoint action.

The easiest way of getting the EndpointArn would be to store it along with or instead of the APNS token in your DB, assuming you are using CreatePlatformEndpoint. Otherwise have a look at this question: Amazon SNS: How to get EndpointArn by token(registrationId) using amazon .net sdk?

Community
  • 1
  • 1
Baris Akar
  • 4,895
  • 1
  • 26
  • 54
  • This is exactly what I ended up doing. Before storing the apns token into the DB, I make a `CreatePlatformEndpoint` request and then store the resulting `EndpointArn` in the DB as well. When I publish, I publish to the `EndpointArn`. Seems like a bit of unnecessary overhead, but it works. – mverderese Sep 23 '15 at 16:33