Skip to content

Add support for arbitrary JSON blocks#1497

Merged
nlopes merged 1 commit into
slack-go:masterfrom
tgvashworth:tom-a/json-block
Apr 5, 2026
Merged

Add support for arbitrary JSON blocks#1497
nlopes merged 1 commit into
slack-go:masterfrom
tgvashworth:tom-a/json-block

Conversation

@tgvashworth

Copy link
Copy Markdown
Contributor

As Slack introduces new block types, this change allows users to include any block type by specifying its JSON representation directly.

Create blocks from raw JSON for testing new Slack features before library support, and for copy-pasting from Block Kit Builder.

Usage

// Copy JSON from Block Kit Builder
contextActionsJSON := `{
    "type": "context_actions",
    "block_id": "feedback",
    "elements": [...]
}`

// Create block (preserves all fields)
block, err := slack.BlockFromJSON(contextActionsJSON)
// or use MustBlockFromJSON() in tests

// Mix with regular blocks
msg := slack.NewBlockMessage(
    slack.NewDividerBlock(),
    block,
    slack.NewSectionBlock(...),
)

As Slack introduces new block types, this change allows users to include
any block type by specifying its JSON representation directly.
@nlopes nlopes force-pushed the tom-a/json-block branch from 7d53f89 to 605eccc Compare April 5, 2026 20:28
@nlopes nlopes merged commit 063d013 into slack-go:master Apr 5, 2026
4 checks passed
nlopes added a commit that referenced this pull request Apr 5, 2026
Closes #1338 (especially after we merged #1497)
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