Skip to content

feat(slack): use native markdown_text for outgoing messages#440

Merged
dancer merged 2 commits into
vercel:mainfrom
raimondlume:feat/slack-native-markdown
May 5, 2026
Merged

feat(slack): use native markdown_text for outgoing messages#440
dancer merged 2 commits into
vercel:mainfrom
raimondlume:feat/slack-native-markdown

Conversation

@raimondlume
Copy link
Copy Markdown
Contributor

@raimondlume raimondlume commented May 1, 2026

Summary

Slack now natively supports markdown via the markdown_text field on chat.postMessage / postEphemeral / update / scheduleMessage. Previously the adapter converted outgoing markdown to mrkdwn and synthesized Block Kit table blocks (with ASCII fallback) to work around mrkdwn's lack of table support.

This PR passes markdown straight through on the Slack Web API methods that support markdown_text. Tables, headings, fenced code blocks, blockquotes, and nested lists now render natively in those Slack messages instead of degrading.

Interactive response_url payloads are the one exception: e2e testing showed Slack rejects markdown_text there with {"ok":false,"error":"no_text"}, so response_url edits intentionally keep a small mrkdwn text fallback.

Builds on my prev PR #349, which started using Slack's native markdown rendering for streamed tables.

What changes

  • { markdown } and { ast } messages on Slack Web API methods -> markdown_text field
  • response_url edits -> mrkdwn text fallback
  • string and { raw } messages -> still text (preserves literal * / _)
  • Removes the native table-block fabrication and broad markdown-to-mrkdwn rendering path
  • Keeps a response_url-only markdown-to-mrkdwn renderer for Slack's legacy interaction webhook surface
  • Removes the deprecated SlackMarkdownConverter alias (use SlackFormatConverter)
  • renderFormatted(ast) now returns standard markdown instead of mrkdwn
  • Incoming message events are still parsed as mrkdwn — unchanged

Test plan

  • Focused Slack unit tests for toSlackPayload, response_url fallback rendering, and response_url edit payloads
  • Integration tests (packages/integration-tests/src/slack.test.ts) updated for markdown_text wire format
  • pnpm --filter @chat-adapter/slack typecheck
  • pnpm check
  • pnpm --filter @chat-adapter/slack build
  • Smoke-tested locally in a separate app via packed tarball — markdown posts render with native headings/tables/code blocks in Slack
  • Smoke-tested ephemeral action response_url edits — Slack rejects markdown_text; response_url fallback uses mrkdwn text

Before / after screenshots:
image

@raimondlume raimondlume requested a review from a team as a code owner May 1, 2026 14:00
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 1, 2026

@raimondlume is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Slack now natively renders markdown via the `markdown_text` parameter on
chat.postMessage / postEphemeral / update / scheduleMessage and via
response_url payloads. The adapter passes markdown through directly instead
of converting to mrkdwn.

- Tables, headings, code fences, blockquotes, and nested lists render
  natively in Slack instead of falling back to ASCII / mrkdwn.
- `string` and `{ raw }` messages still go to `text` (preserves literal `*`).
- `{ markdown }` and `{ ast }` messages go to `markdown_text` (12k char limit).
- `renderWithTableBlocks`, `toBlocksWithTable`, `mdastTableToSlackBlock`,
  and the AST→mrkdwn renderer (`fromAst` / `nodeToMrkdwn`) are removed.
- `SlackMarkdownConverter` alias is removed; use `SlackFormatConverter`.
- `renderFormatted(ast)` now returns standard markdown (was mrkdwn).
- Incoming `message` events still arrive as mrkdwn and are parsed unchanged.

Net -473 lines across markdown.ts and the five sender call sites.
@dancer dancer force-pushed the feat/slack-native-markdown branch from 82b4c9c to f33bea3 Compare May 5, 2026 21:11
@dancer dancer merged commit 3546b3f into vercel:main May 5, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants