| #!/usr/bin/env node | 
 | const { WebClient } = require('@slack/web-api'); | 
 | const { Command } = require('commander'); | 
 | const program = new Command(); | 
 |  | 
 | program | 
 |     .arguments('<message>') | 
 |     .description( 'Sends a message to a slack channel.') | 
 |     .option('-d, --debug', 'output extra debugging') | 
 |     .option('-c, --channel <channel_id>', 'send message to slack channel', "dereko") | 
 |     .parse(process.argv); | 
 |  | 
 | const options = program.opts(); | 
 | if (options.debug) console.log(options); | 
 |  | 
 | // An access token (from your Slack app or custom integration - xoxp, xoxb) | 
 | const token = process.env.SLACK_TOKEN; | 
 |  | 
 | const web = new WebClient(token); | 
 | const conversationId = options.channel; | 
 |  | 
 | (async () => { | 
 |   // See: https://api.slack.com/methods/chat.postMessage | 
 |   const res = await web.chat.postMessage({ channel: conversationId, text: program.args[0] }); | 
 |  | 
 |   // `res` contains information about the posted message | 
 |   console.log('Message sent: ', res.ts); | 
 | })(); |