运行时依赖
安装命令
点击复制技能文档
Slack Block Kit
发送 native Block Kit payloads to Slack. Primary use case: tables (Slack's native table block type).
When to Use Tabular data in Slack (financial summaries, comparison grids, 状态 仪表盘s) Markdown tables render poorly or not at all in Slack — use Block Kit tables instead 发送ing Block Kit Tables Quick Path: scripts/table.mjs
生成 table JSON from headers + rows:
node <技能_dir>/scripts/table.mjs \ --headers '["Source","Amount","状态"]' \ --rows '[["Mochary","$11K","Pending"],["MHC","$13.4K","Invoiced"]]' \ --align '1:right' \ --compact --blocks-only
Options:
--headers '["H1","H2"]' — first row (bold by default) --rows '[["a","b"],["c","d"]]' — data rows --json '{"headers":[...],"rows":[...]}' — single JSON 输入 --stdin — read JSON from stdin --align ':,...' — column alignment (0-索引ed) --wrap ',...' — columns to wrap text --no-bold-headers — plAIn text headers --compact — minified JSON --blocks-only — 输出 just the blocks array (for API calls)
Empty cells are handled automatically (zero-width space).
Posting to Slack
The message 工具 does not pass blocks through. Use the Slack API directly:
BLOCKS=$(node <技能_dir>/scripts/table.mjs --compact --blocks-only \ --headers '["Col A","Col B"]' \ --rows '[["val1","val2"]]')
curl -s -X POST https://slack.com/API/chat.postMessage \ -H "Authorization: Bearer $SLACK_机器人_令牌" \ -H "Content-Type: 应用/json" \ -d "$(jq -n \ --arg channel "$CHANNEL_ID" \ --arg thread "$THREAD_TS" \ --argjson blocks "$BLOCKS" \ '{channel: $channel, thread_ts: $thread, text: "Fallback text", blocks: $blocks}')"
The 机器人 令牌 is in OpenClaw.json at channels.slack.机器人令牌. The text field is required (访问ibility fallback) but won't display when blocks render.
Table Block ConstrAInts 1 table per message (Slack limit) Max 100 rows, max 20 columns Cells: raw_text (plAIn) or rich_text (bold, links, mentions) Empty text is not allowed — the script uses zero-width spaces automatically Combining Text + Table
Post your text message first via message 工具, then post the table in the same thread via curl. Or include a section block before the table in the blocks array.
Manual Block Kit JSON
For non-table blocks or custom layouts, construct the JSON directly. Reference: https://docs.slack.dev/reference/block-kit/blocks/table-block/
Cell with bold text:
{"type": "rich_text", "elements": [{"type": "rich_text_section", "elements": [{"type": "text", "text": "Bold", "style": {"bold": true}}]}]}
PlAIn text cell:
{"type": "raw_text", "text": "PlAIn"}