@stroeer/slack
v1.0.1
Published
Slack-Wrapper for Node.
Downloads
3
Readme
enga-node-slack
Slack utils for nodejs.
yarn add @stroeer/slack
Posting a message
const { Slack } = require('@stroeer/slack')
const slack = new Slack({ token: process.env.SLACK_BOT_ACCESS_TOKEN })
slack.chat.postMessage({ channel: '#general', text: 'Hello, I'm a bot message.' })
Verifying requests coming from slack by signature
const { Slack } = require('@stroeer/slack')
const slack = new Slack({
signingSecret: process.env.SLACK_SIGNING_SECRET
})
const boot = (event, context, callback) => {
let data = {}
const verifiedSignature = slack.verifySignature(event)
if (verifiedSignature === false) {
console.error('Error verifying signature')
response.body = '{ "error": "signature failed" }'
callback(null, response)
return
}
}