The new Slack platform and the features described below are in beta and under active development.

Built-in types

Type Kind Description
Schema.types.string String UTF-8 encoded string, up to 4000 bytes
Schema.types.boolean Boolean a logical value, must be either true or false
Schema.types.array Array An array of items (based on a type that you specify)
Schema.types.object Object A custom Javascript object, like {"site": "slack.com"}
Schema.types.integer Integer a whole number, such as -1, 0, or 31415926535
Schema.types.number Number a number that allows decimal points such as 13557523.0005
Schema.slack.types.user_id Slack User ID a Slack user ID such as U123ABC456 or W123ABC456
Schema.slack.types.channel_id Slack Channel ID a Slack channel ID such as C123ABC456 or D123ABC456
Schema.slack.types.usergroup_id Slack User Group ID a Slack channel ID, such as S123ABC456
Schema.slack.types.timestamp Integer The number of seconds elapsed since the UNIX epoch
Schema.slack.types.blocks Slack Blocks An object that contains layout and style information about your message
Schema.slack.types.interactivity Object An object that contains context about the interactive event that led to opening of the form
Schema.slack.types.user_context Object Represents a user who interacted with a workflow at runtime
Schema.slack.types.date String A string containing a date, format is displayed as YYYY-MM-DD
Schema.slack.types.rich_text Object A way to nicely format messages in your app. This type cannot convert other message types e.g. blocks, strings
Schema.slack.types.oauth2 Object The OAuth2 context created after authenticating with external auth

Have 2 minutes to provide some feedback?

We'd love to hear about your experience with the new Slack platform. Please complete our short survey so we can use your feedback to improve.

Strings

Declare an input or output parameter as a string like this:

// ...
properties: {
  someStringVar: {
    type: Schema.types.string
  }
}
// ...

Boolean

Declare an input or output parameter as a boolean like this:

// ...
properties: {
  someBoolVar: {
    type: Schema.types.boolean
  }
}
// ...

Array

Declare an input or output parameter as an array of types:

// ...
properties: {
    directReports: {
        type: Schema.types.array,
        items: {
            type: Schema.types.object,
            properties: {
                email: { type: Schema.types.string },
                name: { type: Schema.types.string },
            },
            required: ["email", "name"],
        }
    }
}
// ...

Above, we're using a custom object type that contains two properties: an email field and a name field.

Here's an example of an array of strings, using the optional enum property to ensure string values are one of the given enums:

// ...
properties: {
  usersArray: {
    type: Schema.types.array,
    item: {
      type: Schema.types.string,
      enum: [
            "one",
            "two",
            "three",
        ],
    }
  }
}
// ...

Object

Declare an input or output parameter as a custom object type:

// ...
properties: {
    manager: {
        type: Schema.types.object,
        properties: {
            email: { type: "string" },
            name: { type: "string" },
        },
    },
}
// ...

Integer

Declare an input or output parameter as a integer like this:

// ...
{
  name: "times_int",
  title: "number of time integer",
  type: Schema.types.integer,
  description: "times for meeting",
  minimum: -1,
  maximum: 100,
// ...

Number

Declare an input or output parameter as a number like this:

// ...
  name: "times",
  title: "number of times",
  type: Schema.types.number,
  description: "times for meeting",
  minimum: -1,
  maximum: 100,
// ...

User ID

Declare an input or output parameter as a user_id like this:

// ...
input_parameters: {
    properties: {
      currentUser: {
        type: Schema.slack.types.user_id,
      },
// ...

Channel ID

Declare an input or output parameter as a channel_id like this:

// ...
input_parameters: {
    properties: {
      currentChannel: {
        type: Schema.slack.types.channel_id,
      },
// ...

Usergroup ID

Declare an input or output parameter as a usergroup_id like this:

// ...
input_parameters: {
    properties: {
      usergroup_id: {
            type: Schema.slack.types.usergroup_id,
          },
    // ...

Timestamp

Declare an input or output parameter as a timestamp like this:

// ...
{
  "type": "shortcut",
  "name": "Create an Incident",
  "workflow": "#/workflows/createIncidentByButtonClick",
  "inputs": {
    "currentTime": {
      "value": "{{data.trigger_ts}}",
      "type": Schema.slack.types.timestamp
    },
    "interactivity_context": {
      "value": "{{data.interactivity}}"
    }
  }
}
// ...

Blocks

Declare an input or output parameter as a Block Kit JSON object like this:

// ...
properties: {
    recipeBlockKit: {
        type: Schema.slack.types.blocks
    },
}
// ...

You can use handmade Block Kit JSON objects, or those built with the Block Kit builder.

Interactivity

Declare the interactive type:

// ...
{
  input_parameters: {
    properties: {
      interactivity: {
        type: Schema.slack.types.interactivity,
      },
// ...

User Context

Use the user context type to report information about a specific interactive user:

// ...
  input_parameters: {
    properties: {
      channel_id: {
        type: Schema.slack.types.channel_id,
        description: "Which channel?",
      },
    person_reporting_bug: {
       type: Schema.slack.types.user_context,
       description: "Which user?",
      },
// ...
User Context example

This example illustrates how to use the type Schema.slack.types.user_context in a workflow that reports a Bug in a system and collects the reporting persons' information.

  const ReportBugWorkflow = DefineWorkflow({
    callback_id: "report_bug",
    title: "Report a Bug",
    description: "Report a bug",
    input_parameters: {
      properties: {
        channel_id: {
          type: Schema.slack.types.channel_id,
          description: "Which channel?",
        },
      person_reporting_bug: {
        type: Schema.slack.types.user_context,
        description: "Which user?",
        },
      },
      required: ["person_reporting_bug"],
    },
  });

  ReportBugWorkflow.addStep(
    CreateBugFunction,
    {
      title: "title",
      summary: "summary",
      urgency: "S0",
      channel_id: ReportBugWorkflow.inputs.channel_id,
      creator: ReportBugWorkflow.inputs.person_reporting_bug,
    },
  );

Date

Use the date to provide information about when a message was sent:

// ...
fields: {
  elements: [
    {
        name: "date",
        title: "Date Posted",
        type: Schema.slack.types.date,
      },
// ...
Date example

This form requires a date as input and prints it along with the message once the form is submitted:

const formData = TestReverseWorkflow.addStep(Schema.slack.functions.OpenForm, {
  title: "Reverse string form",
  submit_label: "Submit form",
  description: "Submit a string to reverse",
  interactivity: TestReverseWorkflow.inputs.interactivity,
  fields: {
    required: ["channel", "stringInput", "date"],
    elements: [
      {
        name: "stringInput",
        title: "String input",
        type: Schema.types.string,
      },
      {
        name: "date",
        title: "Date Posted",
        type: Schema.slack.types.date,
      },
      {
        name: "channel",
        title: "Post in",
        type: Schema.slack.types.channel_id,
        default: TestReverseWorkflow.inputs.channel,
      },
    ],
  },
});



// Add the date parameter as a step in your workflow. The message and date will be printed side by side.
TestReverseWorkflow.addStep(Schema.slack.functions.SendMessage, {
  channel_id: formData.outputs.fields.channel,
  message: reverseStep.outputs.reverseString + " " +
    formData.outputs.fields.date,
});

Rich Text

Use the rich_text type to collect formatted text from a user:

// ...
elements: [
      {
        name: "formattedStringInput",
        title: "String input",
        type: Schema.slack.types.rich_text, 
      },
// ...
Rich Text example

Use the OpenForm built-in function to collect a formatted message from a user by using the rich_text type.

const formData = TestWorkflow.addStep(Schema.slack.functions.OpenForm, {
  title: "Send Message Form",
  submit_label: "Send Message form",
  interactivity: TestReverseWorkflow.inputs.interactivity,
  fields: {
    required: ["channel", "formattedStringInput"],
    elements: [
      {
        name: "formattedStringInput",
        title: "String input",
        type: Schema.slack.types.rich_text, 
      },
      {
        name: "channel",
        title: "Post in",
        type: Schema.slack.types.channel_id,
        default: TestReverseWorkflow.inputs.channel,
      },
    ],
  },
});

// To share this message object with other users, embed it into a built-in function like SendMessage.
TestWorkflow.addStep(Schema.slack.functions.SendMessage, {
  channel_id: formData.outputs.fields.channel,
  message: formData.outputs.fields.formattedStringInput,
});