Created
June 25, 2021 00:52
-
-
Save deguchi/a33c008621cedc6cb6c198967516523a to your computer and use it in GitHub Desktop.
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 { WebClient } = require('@slack/web-api'); | |
require('dotenv').config(); | |
const token = process.env.SLACK_TOKEN; | |
console.log('token', token) | |
const web = new WebClient(token); | |
const slack = async (text) => { | |
const result = await web.chat.postMessage({ | |
text: text, | |
channel: '#bot', | |
}); | |
// The result contains an identifier for the message, `ts`. | |
console.log(`Successfully send message ${result.ts}`); | |
}; | |
module.exports = slack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment