GithubHelp home page GithubHelp logo

felipesabino / lambda-push-notifications Goto Github PK

View Code? Open in Web Editor NEW

This project forked from artema/lambda-push-notifications

0.0 2.0 0.0 4 KB

AWS Lambda-based push notifications.

JavaScript 100.00%

lambda-push-notifications's Introduction

Amazon Web Services Lambda based push notifications. Publish notifications to a single SNS topic and broadcast push notifications to APNS and GCM services from a Lambda function.

Installation

npm install lambda-push-notifications --save

Usage

Create a Lambda function with an SNS event source:

var factory = require('lambda-push-notifications');

exports.handler = function(event, context) {
  var handler = factory({
    //Configure SNS for the AWS SDK for Node here
    sns: {
      region: 'us-west-2'
    },
    //APNS application for push notifications
    apns: {
      sandbox: false,
      application: 'arn:aws:sns:us-west-2:123456789:app/APNS/APNS_APPLICATION'
    },
    //GCM application for push notifications
    gcm: {
      application: 'arn:aws:sns:us-west-2:123456789:app/GCM/GCM_APPLICATION'
    }
  });

  handler(event, function(err) {
    //Ignore EndpointDisabled errors
    if (err && err.code !== 'EndpointDisabled') {
      return context.done(err, 'Task failed.');
    }

    context.succeed();
  });
};

Source SNS topic should receive notifications in the following format:

{
  apns: { alert: 'Test message', badge: 1, sound: 'default' }
  gcm: { text: 'Test message', data: 12345 }
  apns_recipients: ['APNS device token'],
  gcm_recipients: ['GCM device token']
}

lambda-push-notifications's People

Contributors

artema avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.