Artur79
Artur79

Reputation: 13697

Is it possible to post code snippet with Botkit to Slack

I'd like to know is it possible to post a message with attachment, similar like I can add using Slack' action Code or text snippet, as the reply from my bot. Should I use bot.reply or maybe some other method?

Upvotes: 0

Views: 831

Answers (1)

jschnurr
jschnurr

Reputation: 1191

You can upload through the files.upload API, using the Botkit interface, like so:

slackBot.api.files.upload({
  file: fs.createReadStream('./codeForReview.js'),
  channels: '#general',
  initial_comment: 'Can you guys have a look at this please?',
  title: 'Updated code',
});

Upvotes: 1

Related Questions