Code Monkey home page Code Monkey logo

feathers-aws-sns's Introduction

feathers-aws-sns

Feathers AWS SNS service

Installation

npm install @powerkernel/feathers-aws-sns --save

Documentation

Feathers plugin to use Amazon Simple Notification Service (SNS)

Available Services

The following services are supported and map to the appropriate SNS resource: Publish Topics Subscriptions

This is pretty important! Since this connects to your AWS account you want to make sure that you don't expose these endpoints via your app unless the user has the appropriate permissions. You can prevent any external access by doing this:

const { Forbidden } = require('@feathersjs/errors');

app.service('/sns/publish').before({
  all: [
    context => {
      if(context.params.provider) {
        throw new Forbidden('You are not allowed to access this');
      }
    }
  ]
});

Complete Example

Here's an example of a Feathers server that uses feathers-aws-sns to send SMS direct to a phone number.

const feathers = require('@feathersjs/feathers');
const {Publish} = require('@powerkernel/feathers-aws-sns');

// Initialize the application
const app = feathers();

// Initialize the service
const service = new Publish({
    region: 'us-east-1',
    accessKey: 'your_aws_access_key',
    secretKey: 'your_aws_access_secret_key'
  });
app.use('/sns/publish', service);

// Send an SMS
result = await app.service('sns/publish').create({
    PhoneNumber: "+13305555555",
    Message: 'Hello World'
  });

License

Copyright (c) 2020 Power Kernel

Licensed under the MIT license.

feathers-aws-sns's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar harrytang avatar

Watchers

 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.