0

I have installed botkit on ubuntu. I have tested some examples sending/ receiving messages. It is working fine. I have tried to trigger a file upload event trigger on slack, I have received message/ file upload trigger event in botkit and I have problem to construct the multi form data in node.js.

node.js

  controller.on('file_created', function(file) {
    console.log("file upload testing' + file)

output:

file upload testing undefined

We need help 'how to construct the data and to get the files data particular on url_private property field to retrive the url which we uploaded.

generalhenry
  • 17,227
  • 4
  • 48
  • 63
  • Can you provide more code than this? Is there a tutorial you are following? – joncodo Sep 21 '16 at 23:08
  • var controller = Botkit.slackbot({ debug: false }); controller.spawn({ token: process.env.token }).startRTM(function(err) { if (err) { throw new Error(err); } }); controller.on('file_created', function(content){ console.log("file upload testing" + content.url_private); console.log("file upload testing" + file.url_private); }); – Jothiprakash Sep 22 '16 at 14:34

1 Answers1

0

I've only found success with the file_shared in event with botkit. Such as:

controller.on('file_shared', function(bot, file){
   console.log(JSON.stringify(file));
});

or the file_share event:

controller.on('file_share', function(bot, file){
   console.log(JSON.stringify(file));
});
Ronin
  • 2,867
  • 3
  • 14
  • 14