Skip to main content

rich_text type

This reference documents the Slack types at the platform level. Their availability and structure may differ in each SDK

Type: slack#/types/rich_text

PropertyTypeDescription
defaultThe type that is being described.An optional parameter default value.
descriptionstringAn optional parameter description.
examplesAn array of the type being described.An optional list of examples.
hintstringAn optional parameter hint.
titlestringAn optional parameter title.
typestringString that defines the parameter type.

Declare a rich_text type:

// ...
"elements": {
"formattedStringInput": {
"title": "String input",
"type": "slack#/types/rich_text"
}
}
// ...
Rich text example

In this example workflow, we collect a formatted message from the user using the rich_text type.

import { DefineWorkflow, Schema } from "deno-slack-sdk/mod.ts";

const TestWorkflow = DefineWorkflow({
callback_id: "test",
title: "Test",
input_parameters: {
properties: {
channel: { type: Schema.slack.types.channel_id },
interactivity: { type: Schema.slack.types.interactivity },
},
required: ["interactivity"],
},
});

const formData = TestWorkflow.addStep(Schema.slack.functions.OpenForm, {
title: "Send Message Form",
submit_label: "Send Message form",
interactivity: TestWorkflow.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: TestWorkflow.inputs.channel,
},
],
},
});

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