feat(message send): add --blocks flag for raw Block Kit payloads#82
Closed
thehesiod wants to merge 1 commit intostablyai:mainfrom
Closed
feat(message send): add --blocks flag for raw Block Kit payloads#82thehesiod wants to merge 1 commit intostablyai:mainfrom
thehesiod wants to merge 1 commit intostablyai:mainfrom
Conversation
Adds a `--blocks <path>` option to `message send` that reads a JSON array of Block Kit blocks from a file (or `-` for stdin) and passes it to chat.postMessage as-is, bypassing the built-in markdown-to-rich-text conversion. This unlocks structured layouts that the markdown converter can't express — headers, dividers, context blocks, and especially the `table` block introduced by Slack in August 2025. User tokens already have the `chat:write` scope needed, so no new auth setup is required. The positional <text> argument (when provided alongside --blocks) is still sent as the message `text` fallback for notifications and unfurls. `--blocks` cannot be combined with `--attach` since uploads take a separate code path. - CLI: add --blocks option with mutual-exclusion check vs --attach - Actions: loadBlocksFromPath() reads/parses/validates JSON array; sendMessage() prefers loaded blocks over markdown conversion - README + skill docs: document the flag with a table-block example - Tests: 4 new cases covering happy path, non-array JSON, malformed JSON, and precedence over text-derived blocks
Contributor
|
will review and get this in today |
This was referenced May 5, 2026
Contributor
|
Hi @thehesiod — thanks for this! I merged a continuation of your work as #89 (released in v0.9.3) since I couldn't push directly to your fork to resolve the merge conflict with main. The squash commit on main credits you, and I added one small follow-up: |
Author
|
thanks to @claude :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--blocks <path>option tomessage sendthat reads a JSON array of Block Kit blocks from a file (or-for stdin) and passes it tochat.postMessageas-is, bypassing the built-in markdown-to-rich-text conversion.This unlocks structured layouts that the markdown converter can't express —
header,divider,context,section(withaccessory), and especially thetableblock introduced by Slack in August 2025. User tokens already carry thechat:writescope needed; no new auth is required.Example
Behavior
--blocksand--attachare mutually exclusive (uploads take a separate code path that doesn't carry blocks)<text>remains optional when--blocksis set, but if provided it is sent as the messagetextfallback used for notifications and unfurls--blocksis set, the automatic markdown→rich_text conversion is skippedFiles
src/cli/message-command.ts— add--blocksoption + mutual-exclusion checksrc/cli/message-actions.ts—loadBlocksFromPath()reads/parses/validates;sendMessage()prefers loaded blocks over text-derived onesREADME.md,skills/agent-slack/SKILL.md,skills/agent-slack/references/commands.md— document the flag with a table-block exampletest/message-send.test.ts— 4 new cases (happy path, non-array JSON, malformed JSON, precedence over text)Test plan
bun test— all 185 tests pass (4 new)bun run typecheck— cleanbun run lint— no new warnings (5 pre-existing line-count warnings unchanged)bun run format:check— cleanbun run buildand sent a real message to a DM with a header + table block; table rendered natively in the Slack client