Skip to content

Instantly share code, notes, and snippets.

@ismaelc
Created April 28, 2020 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ismaelc/f099b0f0a636d09ff1a9784c4cd937ca to your computer and use it in GitHub Desktop.
Save ismaelc/f099b0f0a636d09ff1a9784c4cd937ca to your computer and use it in GitHub Desktop.
// Initialize using signing secret from environment variables
const { createEventAdapter } = require('@slack/events-api');
const slackEvents = createEventAdapter(process.env.SLACK_SIGNING_SECRET);
const port = process.env.PORT || 3000;
// Attach listeners to events by Slack Event "type". See: https://api.slack.com/events/message.im
slackEvents.on('message', (event) => {
console.log(`Received a message event: user ${event.user} in channel ${event.channel} says ${event.text}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment