@nutshelllab/sns-messenger

Just sugar syntax over AWS SNS.send()

Usage no npm install needed!

<script type="module">
  import nutshelllabSnsMessenger from 'https://cdn.skypack.dev/@nutshelllab/sns-messenger';
</script>

README

sns-messenger

Build Status npm bundle size Maintainability

Just sugar syntax over AWS SNS.send()

Install

yarn add @nutshelllab/sns-messenger

Usage

import send from '@nutshelllab/sns-messenger'

const arn = topic => {
  const region = process.env.AWS_REGION
  const account = process.env.AWS_ACCOUNT_ID
  const stage = process.env.SLS_STAGE
  return `arn:aws:sns:${region}:${account}:${topic}-${stage}`
}

(async () => {
  await send(arn('my-topic'), { foo: 'bar' }, { Subject: 'foobar' })
})

API

snsMessenger(topicArn, payload, options)

topicArn

Type: string

SNS topic's arn to send message

payload

Type: Object

Message payload

options

Type: Object

Extra AWS SNS parameters, see AWSJavaScriptSDK documentation

License

MIT © Nutshell