From 5df47d25ab0fae55f61e7839d7b8e92906753351 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Fri, 11 Jul 2025 00:51:28 -0700 Subject: [PATCH] feat(types): add markdown block --- packages/types/src/block-kit/blocks.ts | 30 ++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index 63ef52638..9bf347e68 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -44,16 +44,17 @@ export interface Block { * {@link https://api.slack.com/reference/block-kit/blocks Blocks reference}. */ export type KnownBlock = - | ImageBlock - | ContextBlock | ActionsBlock + | ContextBlock | DividerBlock - | SectionBlock - | InputBlock | FileBlock | HeaderBlock - | VideoBlock - | RichTextBlock; + | ImageBlock + | InputBlock + | MarkdownBlock + | RichTextBlock + | SectionBlock + | VideoBlock; /** * A helper union type of all known Blocks as well as the generic {@link Block} interface. A full list of known blocks @@ -245,6 +246,23 @@ export interface InputBlock extends Block { dispatch_action?: boolean; } +/** + * @description This block can be used with AI apps when you expect a markdown response from an LLM that can get lost in + * translation rendering in Slack. Providing it in a markdown block leaves the translating to Slack to ensure your message + * appears as intended. Note that passing a single block may result in multiple blocks after translation. + * @see {@link https://api.slack.com/reference/block-kit/blocks#markdown Markdown block reference} + */ +export interface MarkdownBlock extends Block { + /** + * @description The type of block. For a markdown block, `type` is always `input`. + */ + type: 'markdown'; + /** + * @description The standard markdown-formatted text. Limit 12,000 characters max. + */ + text: string; +} + /** * A helper union type of all Block Elements that can be used in a {@link RichTextBlock}. * @see {@link https://api.slack.com/reference/block-kit/blocks#rich_text Rich text block reference}.