@nutshelllab/sns-messenger
v2.2.2
Published
Just sugar syntax over AWS SNS.send()
Downloads
5
Readme
sns-messenger
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