Skip to main content

array type

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

Type: array

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.
itemsobjectThe type of items in the array. Can be one of the following types: channel_id, user_id, usergroup_id, timestamp, string, integer, number, boolean, list_id, canvas_id, canvas_template_id, channel_canvas_id, team_id, file_id.
minItemsintegerMinimum number of items allowed.
maxItemsintegerMaximum number of items allowed.

Declare an array of types:

// ...
"departments": {
"title": "Your department",
"type": "array",
"items": {
"type": "string",
"enum": [
"marketing", "design", "sales", "engineering"
]
}
}
// ...
Arrays and object types

Be sure to define the array's properties in the items object. Untyped objects are not currently supported. In addition, you can only use an object as the item type of array if it's a custom object. Otherwise, you may receive the following error:

Unexpected schema encountered for array type: failed to match exactly one allowed schema for items - {"type":"one_of"} (failed_constraint).

Array example

In this example function, we have an array of the custom type ChannelType as both an input_parameter and output_parameter. See this custom type and array in action in the Deno Archive Channel sample app.

const ChannelType = DefineType(...)

export const FilterStaleChannelsDefinition = DefineFunction({
callback_id: "filter_stale_channels",
title: "Filter Stale Channels",
description:
"Filter out any channels that have received messages within the last 6 months",
source_file: "functions/filter_stale_channels.ts",
input_parameters: {
properties: {
channels: {
type: Schema.types.array,
description: "The list of Channel IDs to filter",
items: {
type: ChannelType,
},
},
},
required: ["channels"],
},
output_parameters: {
properties: {
filtered_channels: {
type: Schema.types.array,
description: "The list of stale Channel IDs",
items: {
type: ChannelType,
},
},
},
required: [],
},
});