feat(block-kit): add card block example#102
Draft
zimeg wants to merge 1 commit into
Draft
Conversation
Add a Block Kit card block example mirroring the official docs example, constructed with the slack_sdk CardBlock type (icon, title, subtitle, hero image, body, and an action button). Includes a test asserting the produced block matches the expected JSON and a README bullet. Docs: https://docs.slack.dev/reference/block-kit/blocks/card-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
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 Block Kit card block example to the
block-kitshowcase, mirroring the official docs example. The example is constructed using the SDK-providedCardBlocktype (imported fromslack_sdk.models.blocks) with an icon, title, subtitle, hero image, body, and an action button.block-kit/src/blocks/card.py—example01()returning aCardBlockblock-kit/tests/blocks/test_card.py— asserts the produced block deep-equals the expected JSON literalblock-kit/README.md— adds the Card bullet (alphabetical, with docs + implementation links)Docs
https://docs.slack.dev/reference/block-kit/blocks/card-block
The example JSON mirrors the docs page (icon, title "Lumon Industries", subtitle, hero image, body, single action button).
Notes
iconandhero_imageare passed asImageElementinstances (matching the neighboringcarousel.pyexample and the docs JSON, which render image element objects). The installedslack_sdk3.42.0 type stub annotates these params asstr, so a targeted# type: ignore[arg-type]is applied — runtime serialization produces the correct{"type": "image", ...}output, verified by the test.Validation
Ran the repo's CI-equivalent checks for the
block-kitshowcase (Python 3.13,slack_sdk3.42.0):ruff check— passedruff format --diff --check— passed (34 files already formatted)mypy ./**/*.py— passed (no issues in 34 source files)pytest— passed (33 passed, including the newtest_card.py)Co-Authored-By: Claude svc-devxp-claude@slack-corp.com
🤖 Generated with Claude Code