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

Custom types

Custom types provide a way to introduce reusable, sharable types to your Run On Slack apps.

When you use a custom type as an input or output parameter in any of your functions, workflows, or datastores, they're automatically registered; you don't need to declare them in your manifest definition like you do for workflows. They just work!

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.

Defining a type

Types can be defined with the top level DefineType export. Below is an example of setting up a custom type object that usable for incidents.

const IncidentType = DefineType({
  title: "Incident Ticket",
  description: "Use this to enter an Incident Ticket",
  name: "Name",
  type: Schema.types.object,
  properties: {
    id: {
      type: Schema.types.string,
      minLength: 3,
    },
    title: {
      type: Schema.types.string,
    },
    summary: {
      type: Schema.types.string,
    },
    severity: {
      type: Schema.types.string,
    },
    date_created: {
      type: Schema.types.number,
    },
  },
  required: [],
});

Registering a Type to the App

To register the newly defined type, add it to the array assigned to the types parameter while defining the manifest.

Note: All custom types must be registered in the manifest in order for them to be used.

Manifest({
  ...
  types: [IncidentType],
});

Referencing Types

To use a Type as a function parameter, set the parameter's type property to the Type it should reference.

// ...
input_parameters: {
  incident: : {
    title: 'A Special Incident',
    type: IncidentType
  }
  // ...
},
// ...

In the above example, the title from the custom type IncidentType is being overridden with the string A Special Incident.