0

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?

Artur79
  • 12,705
  • 1
  • 22
  • 22
  • 1
    Text snippets are not message attachments, but uploaded files. You can upload files through the API, not sure though if botkit supports this. see [files.upload](https://api.slack.com/methods/files.upload) – Erik Kalkoken Aug 08 '18 at 09:59

1 Answers1

1

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',
});
jschnurr
  • 1,181
  • 6
  • 8