This is reference content about building functions and workflows. Learn more if you're not yet familiar with this new Slack platform paradigm.

open_form

Open an interactive form

Facts

Schema ID

Schema.slack.functions.OpenForm

Schema reference

slack#/functions/open_form

Required scopes

No additional scopes are required.

Input parameters

Required parameters
Title of the form shown to the user (24 characters / 8 Japanese characters max)
  • How am I driving?
  • TPS Report Submission
  • Channel hero nomination
A collection of input fields to be shown on the form. See Using forms for schema.
Context about the interactive event that led to opening of the form. See form interactivity for more.
Optional parameters
Description of the form shown to the user
  • Request access to the underground lair on weekends
  • Submit your ideas to the think tank
  • Choose your next adventure
Label of the submit button that the user will click to submit the form
  • Submit complaint
  • Save call log
  • Open mailbox

Output parameters

Required parameters
Values of the input fields filled by the user. See Using forms for details.
Context about the form submit action interactive event

Usage guide

Opens a form for the user to interact with.

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

Learn how to use this function in a workflow to collect information from a user for use in later steps!

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