-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
29 lines (23 loc) · 732 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
const winston = require('winston');
const async = require('async');
const _ = require('lodash');
const slack = require('./lib/slack');
const sns = require('./lib/sns');
var functions = {};
functions.slack = function(event, context) {
winston.info('slack');
winston.info(JSON.stringify(event.Records[0].Sns.Message));
context.succeed();
};
functions.events = function(event, context) {
winston.info('events');
winston.info(JSON.stringify(event.Records[0].Sns.Message));
sns.publish({
topic: process.env.NotificationTopic,
message: JSON.stringify(event.Records[0].Sns.Message)
}, function(err, results) {
context.succeed();
});
};
module.exports = functions;