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
| Property | Type | Description |
|---|---|---|
default | The type that is being described. | An optional parameter default value. |
description | string | An optional parameter description. |
examples | An array of the type being described. | An optional list of examples. |
hint | string | An optional parameter hint. |
title | string | An optional parameter title. |
type | string | String that defines the parameter type. |
allowed_filetypes_group | string | If 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_filetypes | string[] | 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:
- JSON manifest
- Deno Slack SDK
// ...
"file": {
"type": "slack#/types/file_id",
"allowed_filetypes_group": "ALL"
}
// ...
// ...
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"
}
},
],
},
// ...
OpenForm parameters
When using the file_id type in an OpenForm function, there are two additional parameters that can be utilized.
| Parameter | Type | Description |
|---|---|---|
allowed_filetypes_group | string | Can be either ALL or IMAGES_ONLY. If provided, specifies allowed predefined subset of filetypes for file in an OpenForm function. |
allowed_filetypes | array of strings | If 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"],
}
},
);