This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SLACK_BOT_TOKEN=YOUR_BOT_TOKEN | |
SLACK_VERIF_TOKEN=YOUR_VERIF_TOKEN | |
SLACK_SIGNING_SECRET=YOUR_SIGNING_SECRET | |
PORT=5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bodyParser = require('body-parser'); | |
const subjects = require('./elements/subjects.json') | |
module.exports.listenForCommands = async function (app) { | |
app.use(bodyParser.urlencoded({ extended: true })) | |
app.use(bodyParser.json()) | |
app.post('/commands', (req, res) => { | |
const { token, user_id, channel_id } = req.body | |
console.log(`Received a slash command from user ${user_id} in channel ${channel_id}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (process.env.NODE_ENV !== "production") { | |
require("dotenv").config() | |
} | |
const express = require('express') | |
const port = process.env.PORT | |
const app = express() | |
const events = require('./events') | |
const interactions = require('./interactions') | |
const slashCommand = require('./slashCommand') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Here is an <https://witanddelight.com/2020/05/how-white-people-can-be-better-allies-to-the-black-community/|article>: ow how white people can be better allies to the black community :rolled_up_newspaper: :fist:" | |
} | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createMessageAdapter } = require('@slack/interactive-messages') | |
const slackSigningSecret = process.env.SLACK_SIGNING_SECRET | |
const slackInteractions = createMessageAdapter(slackSigningSecret) | |
const articleOrBookButton = require('./elements/articleOrBookButton.json') | |
module.exports.listenForInteractions = function (app) { | |
app.use('/interactions', slackInteractions.requestListener()) | |
} | |
slackInteractions.action({ type: 'select' }, (payload, respond) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/node_modules | |
npm-debug.log | |
.DS_Store | |
/*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (process.env.NODE_ENV !== "production") | |
{ | |
require("dotenv").config() | |
} | |
const express = require('express') | |
const port = process.env.PORT | |
const app = express() | |
app.listen(port, function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createEventAdapter } = require('@slack/events-api') | |
const slackSigningSecret = process.env.SLACK_SIGNING_SECRET | |
const slackEvents = createEventAdapter(slackSigningSecret) | |
function listenForEvents(app) { | |
app.use('/events', slackEvents.requestListener()) | |
} | |
slackEvents.on('app_mention', (event) => { | |
console.log(`Received an app_mention event from user ${event.user} in channel ${event.channel}`) |
NewerOlder