Koa JS middleware to handle Amazon Simple Email Service notifications of SNS
npm install koa-sesA middleware for Koa to receive and handle sns notifications Amazon SNS from Amazon SES.



## Setup
npm i koa-ses -S
Important: To receive notifications in your koa app you should have configured previously SNS with SES in your AWS account. Check docs for more info.
``js
var koa = require('koa');
var koaSES = require('koa-ses');
var app = koa();
// Create a function that will receive the
// notification data coming from AWS. This is required
var notificationHandler = function * (message){
// Your own logic to handle the notification
};
app.use(koaSES(notificationHandler, options));
`messageId
With your own implementation sending emails by SES. You need to store the in db/somewhere to use it later as the reference in the callback. Remember the callback receives the messageId you previously stored when sending the email for the first time.
* messageId: id of the SES email on AWS.
* serviceStatus: SES Status of the email. ['Delivery', 'Bounce', 'Complaint']['Sent', 'Failed']
* from
* status: Simplified status.
* destination
* timestamp
* rawMessage: Need more data for custom behaviour? get it from here.
* path: Path url to receive SNS http/s notifications. Default: /ses/notifications
PR are very welcome to this repo!
- [x] Validate signature of notification
- [ ] Improve code, testing and coverage
npm test`
Please open a github issue if you find a bug or have a question. Thanks.