Skip to main content

open_form

Facts​

DescriptionOpen an interactive form
SchemaSchema.slack.functions.OpenForm
Schema referenceslack#/functions/functions/open_form
Required scopes
No additional scopes required

Input Parameters​

Required Input Parameters

fieldsSchema.types.objectRequired

A collection of input fields to be shown on the form. See Using forms for schema.

interactivitySchema.slack.types.interactivityRequired

Context about the interactive event that led to opening of the form. See form interactivity for more.

titleSchema.types.stringRequired

Title of the form shown to the user (24 characters / 8 Japanese characters max)

Examples
How am I driving?
TPS Report Submission
Channel hero nomination

Optional Input Parameters

descriptionSchema.types.stringOptional

Description of the form shown to the user

Examples
Request access to the underground lair on weekends
Submit your ideas to the think tank
Choose your next adventure
submit_labelSchema.types.stringOptional

Label of the submit button that the user will click to submit the form

Examples
Submit complaint
Save call log
Open mailbox

Output Parameters​

Required Output Parameters

fieldsSchema.types.objectRequired

Values of the input fields filled by the user. See Using forms for details.

interactivitySchema.slack.types.interactivityRequired

Context about the form submit action interactive event

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"],
},
});