Skip to content

parse-server-modules/parse-server-sns-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parse Amazon SNS Push Adapter

This project leverages the Amazon Simple Notification Service (SNS), which attempts to abstract away the complexities of different push notification systems. Currently, there is only support for iOS (Apple Push Notification Service) and Android (Google Cloud Messaging) devices.

To add other push types, you simply need to know what kind of payload format to be sent. This adapter leverages code from the parse-server-push-adapter repo. See the Amazon documentation if you wish to add other types.

Build Status codecov.io NPM Version

Setup

The steps basically entail:

  • Adding Platform endpoints to AWS console
    • Apple requires you loading the prod/development certificates.
  • Setup an IAM role for platform endpoints.
  • Generate AWS access key and secret with this authorized IAM role.
  • Enable CloudSearch logs for debugging.
  • Configure Parse server

Configurating Platform Endpoints

  1. Sign into the Amazon Web Services (AWS) Console.
  2. Select the SNS Service.
  3. Select Create Platform Application.
    • For GCM setup, you must provide an API key. See the instructions about how to generate this key.
    • For APNS setup, you must generate an SSL certificate that can connect to Apple's servers. See step #1 of this tutorail. You will need to choose between Apple Production and Apple Development depending on the cert generated.
  4. Record the Amazon Resource Number (ARN) associated with this new endpoint.

Setting up IAM Role

  1. Go to the Amazon IAM console.
  2. Create a user that will be granted access to SNS.
  3. Select the Policies tab and click on the Create Policy button.
  4. Select Create Your Own Policy and fill out a Policy Name.
  5. Copy this Policy document that will grant blanket access to SNS services. You can add more restrictions later.
    {
       "Version": "2012-10-17",
       "Statement": [
       {
         "Action": [
           "sns:*"
         ],
         "Effect": "Allow",
         "Resource": "*"
       }
      ]
    }
  6. Make sure to Validate the Policy and click Create Policy.
  7. Go back to the Users tab and select the user you created earlier.
  8. In Permissions, select Attach Policy and find the policy we just created to attach it.
  9. Click on Security Credentials and click on Create Access Key.
  10. Record the credentials, which will be used to configure the Parse server.

Configuring Parse Server

Here is a sample config setup:

var pushConfig =  { pushTypes : { android: {ARN : YOUR-ANDROID_ARN-HERE},
                                  ios: {ARN: YOUR-IOS_ARN-HERE}, production: false, bundleId: "beta.parseplatform.yourappname"}
                                 },
                   accessKey: process.env.SNS_ACCESS_KEY,
                   secretKey: process.env.SNS_SECRET_ACCESS_KEY,
                   region: "us-west-2"
                 };

var SNSPushAdapter = require('parse-server-sns-adapter/SNSPushAdapter').default;
var snsPushAdapter = new SNSPushAdapter(pushConfig);
pushConfig['adapter'] = snsPushAdapter;

You then need to instantiate the ParseServer info with the following:

var api = new ParseServer({

  push: pushConfig
});

About

Parse Server SNS Adapter

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •