1.0.0 • Published 8 years ago

sns-listen v1.0.0

Weekly downloads
100
License
MIT
Repository
github
Last release
8 years ago

Amazon AWS SNS endpoint

Version npmnpm DownloadsDependenciesTips

sns-listen handles incoming messages from AWS SNS (Simple Notification Service). It will automaticly confirms subscriptions and emit notifications.

Example

const snsListen = require('sns-listen')

const sns = snsListen()

sns.on('notification', (message) => {
  console.log('got notification', message)
})

sns.on('subscribed', () => {
  console.log('We are now subscribed')
})

sns.on('unsubscribed', () => {
  console.log('Got UnsubscribeConfirmation')
})

sns.on('error', (err) => {
  console.error('Something went wrong', err)
  process.exit()
})

sns.listen(9000)

Use with Express

const express = require('express')
const snsListen = require('sns-listen')

const app = express()

app.post('/sns', snsListen((message) => {
  console.log('got notification', message)
}))

app.listen(9000)

Install

npm install -S sns-listen

License

MIT