Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/powerkernel/feathers-aws-sns
Feathers AWS SNS service
https://github.com/powerkernel/feathers-aws-sns
Last synced: about 2 months ago
JSON representation
Feathers AWS SNS service
- Host: GitHub
- URL: https://github.com/powerkernel/feathers-aws-sns
- Owner: powerkernel
- License: mit
- Archived: true
- Created: 2019-07-25T07:08:27.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T00:51:39.000Z (11 months ago)
- Last Synced: 2024-10-03T18:46:07.211Z (3 months ago)
- Language: JavaScript
- Size: 2.44 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/contributing.md
- License: LICENSE
Awesome Lists containing this project
- awesome-feathersjs - feathers-aws-sns - Feathers AWS SNS service to use with Amazon Simple Notification Service (service) (Plugins / Email and SMS)
README
# 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:
```js
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.
```js
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](LICENSE).