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.

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 U18675309 or W15556162
Schema.slack.types.channel_id Slack Channel ID a Slack channel ID such as C123ABC45 or D987XYZ65
Schema.slack.types.usergroup_id Slack User Group ID a Slack channel ID, such as C1234567
Schema.slack.types.timestamp Slack Timestamp A per-channel unique timestamp used to identify message events
Schema.slack.types.blocks Slack Blocks An Object that contains layout and style information about your message

Strings

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

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

This function takes a string variable named todoTitle as input:

// mainfest.ts
export const CreateTodoItemFunction = DefineFunction({
  callback_id: "create_todo_item",
  title: "Create Todo Item",
  description: "Creates a new todo item",
  source_file: "functions/create_todo_item.ts",
  input_parameters: {
    properties: {
      todoTitle: {
        type: Schema.types.string,
        description: "What do you need to do?"
      },        
    },
    required: ["todoTitle"],
  },
});

Here's an example of using the todoTitle string variable in a function:

// functions/create_todo_item.ts
import type { SlackFunctionHandler } from "deno-slack-sdk/types.ts";
import type { CreateTodoItemFunction } from "../manifest.ts";
import { SlackAPI } from "deno-slack-api/mod.ts";

const create_todo_item: SlackFunctionHandler<typeof CreateTodoItemFunction.definition> = async (
  { inputs, env, token },
) => {
  const client = SlackAPI(token);

  client.apiCall("chat.postMessage", {
    channel: "C123456",
    text: `TODO: ` + inputs.todoTitle,
  });

  return await {
    outputs: {},
  };
};

export default create_todo_item;

Boolean

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

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

This function takes a boolean variable named isHighPriority as input:

// mainfest.ts
export const CreateTodoItemFunction = DefineFunction({
  callback_id: "create_todo_item",
  title: "Create Todo Item",
  description: "Creates a new todo item",
  source_file: "functions/create_todo_item.ts",
  input_parameters: {
    properties: {
      todoTitle: {
        type: Schema.types.string,
        description: "What do you need to do?"
      },
      isHighPriority: {
        type: Schema.types.boolean,
        description: "Is this a high-priority item?"
      },
    },
    required: ["todoTitle","isHighPriority"],
  },
});

Here's an example of using the isHighPriority boolean variable in a function:

// functions/create_todo_item.ts
import type { SlackFunctionHandler } from "deno-slack-sdk/types.ts";
import type { CreateTodoItemFunction } from "../manifest.ts";
import { SlackAPI } from "deno-slack-api/mod.ts";

const create_todo_item: SlackFunctionHandler<typeof CreateTodoItemFunction.definition> = async (
  { inputs, env, token },
) => {
  const client = SlackAPI(token);

  let message;

  if(inputs.isHighPriority) {
      message += "(High Priority!) ";
  }

  message += inputs.todoTitle

  client.apiCall("chat.postMessage", {
    channel: "C123456",
    text: message,
  });

  return await {
    outputs: {},
  };
};

export default create_todo_item;

Array

An array of Slack types:

// ...
properties: {
  usersArray: {
    type: Schema.types.array,
    item: {
      type: Schema.slack.types.user_id
    }
  }
}
// ...

An array of non-Slack types:

// ...
properties: {
  usersArray: {
    type: Schema.types.array,
    item: {
      type: Schema.types.string
    }
  }
}
// ...

Object

An Object that contains information about a manager.

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