Skip to content

Conversation

@tgvashworth
Copy link
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.
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.

1 participant