Skip to content

Instantly share code, notes, and snippets.

@joshuakarjala
Created November 7, 2016 20:13
Show Gist options
  • Save joshuakarjala/d700e2c9259d856a0785b8d9f8d74a5f to your computer and use it in GitHub Desktop.
Save joshuakarjala/d700e2c9259d856a0785b8d9f8d74a5f to your computer and use it in GitHub Desktop.
var slackEvents = require('slack-events-listener')('<verificationToken>', onSlackEvent);
var bodyParser = require('body-parser');
var app = require('express')();
function onSlackEvent(event, cb) {
// do something. call cb with err if you want Slack to resend the message (your database might be down)
writeToDatabase(event, cb);
}
// /slack_events should match whatever webhook you set in Slack
app.use('/slack_events', bodyParser.json(), slackEvents);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment