Our future generation platform is in closed beta. During the beta, expect some rough edges, broken windows overlooking blue sky vistas, and regularly scheduled changes.

Already signed up? Great! You can ignore this.
Need to sign up? Apply to join the beta.

Custom types

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

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.