Skip to main content

Slack Blocks

@mgreten/slack-blocksv2026.11.03.1· MIT· 5d agoBEHAVIORS
01README

Post Block Kit messages to Slack from swamp models and workflows, with optional file attachments uploaded via the modern external-upload flow. Three methods: send (text + blocks + optional thread reply), sendWithFiles (uploads local files first, then posts a message referencing them), and verifyAuth (auth.test smoke check after token setup).

02Behaviors1
@mgreten/slack-blocksv2026.07.16.1slack_blocks.ts
fn send(channel?: string, text: string, blocks: array, threadTs?: string)
Post a Block Kit message to Slack via chat.postMessage. `text` is required as the notification/accessibility fallback.
ArgumentTypeDescription
channel?stringChannel ID or name (defaults to globalArgs.defaultChannel).
textstringPlain-text fallback shown in notifications and accessibility tools.
blocksarrayArray of Block Kit block objects.
threadTs?stringParent message ts to reply in a thread.
fn sendWithFiles(channel?: string, text: string, blocks: array, files: array, threadTs?: string)
Post a Block Kit message, then upload local files and share them as a thread reply under that message. Result: one thread containing the alert message followed by the file attachments. Slack's API does not support embedding files directly inside a Block Kit message, so the files land as a sibling thread reply (never as a top-level channel post).
ArgumentTypeDescription
channel?stringChannel ID or name (defaults to globalArgs.defaultChannel).
textstringPlain-text fallback shown in notifications.
blocksarrayBlock Kit blocks for the message body.
filesarrayFiles to upload and attach as a thread reply under the posted message.
threadTs?stringOptional outer thread ts. When set, both the Block Kit message and the file attachments are placed inside that existing thread.
fn verifyAuth()
Call auth.test to confirm the bot token works. Useful after vault setup.

Resources

slackMessage(14d)— Audit record of a posted Slack message: channel, ts, file count, success.
authCheck(7d)— Result of an auth.test verification call.
03Previous Versions5
2026.10.14.1MIT(was none)
2026.07.16.1

Rebuild against swamp CLI 20260716

2026.06.27.2
2026.06.27.1
2026.05.20.1

Initial release: chat.postMessage with Block Kit + file uploads shared into the message thread + auth.test verifier

04Stats
A
93 / 100
Downloads
213
Archive size
8.7 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault0/1missing
    • files/README.md--Line 34 sets the secret `--global-arg botToken` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.

    Fix or accept each secret-unsafe-docs warning: the README, the manifest description and describe strings should store secrets with `swamp vault put <vault> <key>` (it prompts for the value) and pass them as `${{ vault.get(<vault>, <key>) }}`.

  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License2/2earned
  • Verified public repository2/2earned
05Platforms