0

I have such interactive button I place at the bottom of backend-generated message:

enter image description here

The button click calls the dialog:

enter image description here

If I enter the public URL of an image in the 'URL' field it is successfully sent to the backend and I'm able to update the backend-generated message with an image. But instead of uploading file somewhere and copying it there I'd like to click 'upload image' in the dialog and select file from a disk. Is this possible?

Tom Halson
  • 380
  • 3
  • 12
toinbis
  • 747
  • 7
  • 23

1 Answers1

1

No. Uploading files is currently not supported by Slack Dialogs.

But you could implement it yourself with an upload script that runs in the browser and is called by a link button from Slack. This would work similar to this example for a file download.

The link button is a variation of an message button and has to be placed in a message (e.g. next to your Add note button), but can not be placed inside the Dialog.

Here is the basic outline:

  1. User clicks on "Add image" button in message
  2. Browse opens and runs upload script
  3. The upload script requests the user to specify which file to upload
  4. Script uploads the file (e.g. to your server or Slack) and links it to the user's request

Things to consider:

  • You have to link the current session with your script, e.g. by transferring an ID in the link (which might infer security concerns)
  • This upload function will not be modal like you dialog, so your app needs to be able to handle an asynchronous / parallel upload of files

Check out these pages for more details on uploading files via browser:

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
  • Hi Erik. I've marked the answer as answered though would kindly ask for an elaboration. So I want to go 'implement it yourself with a script path' -> how do I proceed? Is dialog capable of rendering my custom js/css/html where the file upload has to be implemented? What are the steps to get this working? – toinbis Jun 18 '19 at 12:47
  • 1
    You can't do it inside the Dialog. Instead provide a Slack link button in a message (e.g. next to your Add Note button), which calls a script. Let me extend my answer. – Erik Kalkoken Jun 18 '19 at 13:13