1

I have a slack bot built using botkit that is listening for uploaded files from users in a certain channel. I am trying to handle multiple images uploaded simultaneously, in order to have my bot wait for all images to be processed before proceeding to respond to each of them.

I have my application set up to listen for file_shared, file_created, and file_public events, however I am only seeing file_shared ever be triggered by a file upload. I would imagine that file_created would be triggered before file_shared, but this seems to not be the case.

controller.on('file_created', function(res) {
   console.log("created!");
});

controller.on('file_public', function(res) {
   console.log("public!");
});

controller.on('file_shared', function(res) {
   console.log("shared!!");
});

When listening for these events, I only get "shared!!" but not "public!" or "created!" on a file upload, and shared is only triggered after a file has been processed. In addition, my middleware catches two recieved messages on a file upload, one with only a file ID, and one with the full file information. This would be helpful, but it often prints out with the full object first and the ID second, rather than the only-ID object indicating a processing image.

An example of this output is below:

RCVD: { id: 'FAG4C3VNH',
created: 1525114400,
timestamp: 1525114400,
... more file object stuff }

RCVD: { id: 'FAG4C3VNH' }

shared!!

I am looking to find a way to either

a) track how many files are uploaded at one time or

b) track when a file is being processed by Slack in order to wait for it's completion.

Any resources or thoughts are much appreciated!

Eron Salling
  • 185
  • 2
  • 5
  • I think the reason why you don't see the `file_created` and `file_public` events is that they are not created by the same user that installed your Slack app. You can verify this by uploading a new file with the same user that installed the app, which should work. Its my understanding that this behavior is part of Slack's security architecture (same as you can not see messages in private channel which you have not been invited to, even as admin) and I don't think there is a fix for it. – Erik Kalkoken May 01 '18 at 13:07

0 Answers0