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
| Property | Type | Description |
|---|---|---|
default | The type that is being described. | An optional parameter default value. |
description | string | An optional parameter description. |
examples | An array of the type being described. | An optional list of examples. |
hint | string | An optional parameter hint. |
title | string | An optional parameter title. |
type | string | String that defines the parameter type. |
Declare a rich_text type:
- JSON manifest
- Deno Slack SDK
// ...
"elements": {
"formattedStringInput": {
"title": "String input",
"type": "slack#/types/rich_text"
}
}
// ...
// ...
elements: [
{
name: "formattedStringInput",
title: "String input",
type: Schema.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,
});