Skip to main content

open_form

Facts

Description
Schema
Schema reference
Required scopes
No additional scopes required

Input Parameters

Output Parameters

Usage info

Forms are a straight-forward way to collect user input and pass it onto to other parts of your workflow. Their interactivity is one way - users interact with a static form. You cannot update the form itself based on user input.

Refer to Creating a form for guidance.

Form element schema

Form elements have several properties you can customize depending on the element type.

Links using Markdown are supported in the top-level description, but not in individual form element descriptions. See the Announcement Bot tutorial for an example.

PropertyTypeDescriptionRequired?
namestringInternal name of the elementRequired
titlestringTitle of the form shown to the user. Max length is 25 characters.Required
typeSchema.slack.types.*The type of form element to display.Required
descriptionstringDescription of the form shown to the userOptional
defaultsame as type propertyDefault value for this fieldOptional

Form element type parameters

The following parameters are available for each type when defining your form. For each parameter listed, type is required.

Pay careful attention: some element types are prefixed with Schema.types, while some are prefixed with Schema.slack.types.

TODO: Table to go here once i have internet again :TODO

Example workflow step

const openFormStep = SayHelloWorkflow.addStep(
Schema.slack.functions.OpenForm,
{
title: "Send a greeting",
interactivity: SayHelloWorkflow.inputs.interactivity,
submit_label: "Send",
fields: {
elements: [{
name: "recipient",
title: "Recipient",
type: Schema.slack.types.user_id,
}, {
name: "channel",
title: "Channel to send message to",
type: Schema.slack.types.channel_id,
default: SayHelloWorkflow.inputs.channel,
}, {
name: "message",
title: "Message to recipient",
type: Schema.types.string,
long: true,
}],
required: ["recipient", "channel", "message"],
},
},
);

Additional requirements

When creating a workflow that will have a step to open a form, your workflow must have the call to OpenForm be its first step or ensure the preceding step is interactive. An interactive step will generate a fresh pointer to use for opening the form.

Here's an example of a basic workflow definition using interactivity:

import { DefineWorkflow, Schema } from "deno-slack-sdk/mod.ts";

export const SayHelloWorkflow = DefineWorkflow({
callback_id: "say_hello_workflow",
title: "Say Hello to another user",
input_parameters: {
properties: {
interactivity: {
type: Schema.slack.types.interactivity,
},
},
required: ["interactivity"],
},
});