Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-snsclient2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-snsclient2

A client for parsing Amazon AWS SNS requests.

  • 0.4.0
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Amazon AWS SNS (Simple Notification Service) http(s) endpoint

Important API Change from v0.1 to v0.2

The main SNSClient callback now returns the more accepted Node.js method of function(err, msg). v0.1 sent both the error and message as a single argument.

Installation

$ npm install aws-snsclient

Basic Usage

var http = require('http')
  , SNSClient = require('aws-snsclient');

var client = SNSClient(function(err, message) {
    console.log(message);
});

http.createServer(function(req, res) {
    if(req.method === 'POST' && req.url === '/receive') {
        return client(req, res);
    }
    res.writeHead(404);
    res.end('Not found.');
}).listen(9000);

Your client only needs to accept one callback, which accepts an object of the decoded message sent from the SNS topic.

message is the raw JSON. You'll probably want access to: message.Message to get the actual message that you sent.

Confirmation Requests

The initial confirmation request sent out by Amazon is automatically confirmed at the same endpoint. No additional effort needed.

Request Verification

Signatures are automatically verified, but we can optionally verify the correct account id, region, and topics.

var auth = {
    verify: false
};
var client = SNSClient(auth, function(err, message) {
    console.log(message);
});

Verify all credentials

var auth = {
  TopicArn: 'xxx'
};
var client = SNSClient(auth, function(err, message) {
    console.log(message);
});

Use with Express

var express = require('express')
  , app = express.createServer()
  , SNSClient = require('aws-snsclient');

var auth = {
  TopicArn: 'xxx'
}
var client = SNSClient(auth, function(err, message) {
    console.log(message);
});

app.post('/receive', client);

app.listen(9000);

Keywords

FAQs

Package last updated on 25 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc