0

I am setting up a slack dialog form, where a slack user can add a file to the dialog form and then submit it. Where do I need to add a field in my dialog creation, so slack will show a file upload field to the user?

Here is my dialog:

const dialogData = {
    token: authToken,
    trigger_id: slackReqObj.trigger_id,
    response_url: slackReqObj.response_url,
    dialog: JSON.stringify({
        title: 'Upload a file with comments',
        callback_id: 'submit-upload',
        submit_label: 'Submit',
        elements: [
            {
                label: 'Description',
                type: 'textarea',
                name: 'description',
                optional: false
            },
            {
                label: 'Title',
                type: 'text',
                name: 'title',
                value: 'title ...',
                hint: 'Name of the file or title ...'
            }
            // here i would like to give the field/option to upload/attach a file
        ]
    })
};
Rep
  • 109
  • 4
  • 15

1 Answers1

2

Slack Dialogs do not provide any special elements for file upload. There are only three types of elements:

  • Text
  • Textarea
  • Select (drop down lists)

The Text field has a sub-type that supports entering email, number, telephone numbers and urls (on devices that support it like mobiles).

Here is an idea for a workaround: Ask the user to upload his files manually and your app can then detect the upload and connect to the file via Events Api. A file upload will fire the file_created event.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114