Skip to content

Instantly share code, notes, and snippets.

@antonioned
antonioned / function.js
Last active October 30, 2018 16:44 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = process.env.SLACK_WEBHOOK_URL // add the SLACK_WEBHOOK_URL to the env. variables in the Lambda
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};