I would like to create a Slack command /command do-something-with-that-file with at the same time, the user uploading the file.
So far, my command is received but there is no files in the payload. Is this possible?
I have also added files:read in the scope but no luck so far.
A Slack command can only accept text as input. If you upload a file at the same time, it wouldn't be a part of the payload and will be ignored (although uploaded, and accessible through file browser).
Some alternatives you could try though:
files.list method - Look for files uploaded within a few seconds of the moment when you receive the command. The method accepts ts_from and ts_to parameters for this purpose.file_shared event - Subscribe to this event in your app configuration. This event fires every time a file is uploaded in a channel visible to your bot. You could ask the app user to use a certain format to provide with a file upload, and look for a pattern in the event submission.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With