Skip to main content

file_id type

This reference documents the Slack types at the platform level. Their availability and structure may differ in each SDK

Type: slack#/types/file_id

PropertyTypeDescription
defaultThe type that is being described.An optional parameter default value.
descriptionstringAn optional parameter description.
examplesAn array of the type being described.An optional list of examples.
hintstringAn optional parameter hint.
titlestringAn optional parameter title.
typestringString that defines the parameter type.
allowed_filetypes_groupstringIf provided, a predefined subset of filetypes will be restricted for file upload when this type is used in an OpenForm function. Can either be ALL or IMAGES_ONLY.
allowed_filetypesstring[]If provided, only these filetypes are allowed for file upload in an OpenForm function. Empty arrays are not allowed. Filetypes defined here will override any restrictions set in allowed_filetypes_group.

Declare a file_id type:

// ...
"file": {
"type": "slack#/types/file_id",
"allowed_filetypes_group": "ALL"
}
// ...

OpenForm parameters

When using the file_id type in an OpenForm function, there are two additional parameters that can be utilized.

ParameterTypeDescription
allowed_filetypes_groupstringCan be either ALL or IMAGES_ONLY. If provided, specifies allowed predefined subset of filetypes for file in an OpenForm function.
allowed_filetypesarray of stringsIf provided, specifies allowed filetypes for file upload in an OpenForm function. Overrides any restrictions set in allowed_filetypes_group.
File ID example

In this example workflow, we collect a file from the user.

import { Schema } from "deno-slack-sdk/mod.ts";
import { ImageWorkflow } from "../workflows/ImageWorkflow.ts";

const getImageStep = ImageWorkflow.addStep(
Schema.slack.functions.OpenForm,
{
title: "Submit this form",
interactivity: ImageWorkflow.inputs.interactivity,
fields:{
elements: [
{
title: "Enter a file",
name: "image-123",
type: Schema.types.array,
maxItems: 1,
description: "",
items: {
type: Schema.slack.types.file_id,
allowed_filetypes_group: "ALL"
},
}
],
required: ["image-123"],
}
},
);