Skip to content
This repository has been archived by the owner on Feb 15, 2018. It is now read-only.
/ koa-ses Public archive

[unmaintained] Koa JS middleware to handle AWS SNS http notifications coming from AWS SES (Simple Email Service)

License

Notifications You must be signed in to change notification settings

andfk/koa-ses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-ses

THIS MODULE IS UNMAINTAINED. USE IT CAREFULLY.

A middleware for Koa to receive and handle sns notifications Amazon SNS from Amazon SES.

Downloads

## Setup

npm i koa-ses -S

Usage

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.

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));

With your own implementation sending emails by SES. You need to store the messageId 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.

Callback

This is called when the middleware handles a notification with the following params.

  • messageId: id of the SES email on AWS.
  • serviceStatus: SES Status of the email. ['Delivery', 'Bounce', 'Complaint']
  • from
  • status: Simplified status. ['Sent', 'Failed']
  • destination
  • timestamp
  • rawMessage: Need more data for custom behaviour? get it from here.

Options

  • path: Path url to receive SNS http/s notifications. Default: /ses/notifications

Contributing

PR are very welcome to this repo!

To-do

  • Validate signature of notification
  • Improve code, testing and coverage

Tests

npm test

Support

Please open a github issue if you find a bug or have a question. Thanks.

About

[unmaintained] Koa JS middleware to handle AWS SNS http notifications coming from AWS SES (Simple Email Service)

Resources

License

Stars

Watchers

Forks

Packages

No packages published