feat(block-kit): add card block example#96
Closed
zimeg wants to merge 1 commit into
Closed
Conversation
Mirror the official card block docs example in the Bolt for Python Block Kit examples. example01 builds a full card (icon, title, subtitle, hero image, body, action button); example02 shows a minimal card with only a title and an action button. Docs: https://docs.slack.dev/reference/block-kit/blocks/card-block Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Member
Author
|
Closing as duplicate of #102 (same card block example) — consolidating to one PR per block. |
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
cardblock example to the Bolt for Python Block Kit examples, mirroring the official docs example (and the matchingbolt-js-examplescard example).block-kit/src/blocks/card.pyexample01()— a full card with an icon, title, subtitle, hero image, body, and an action button.example02()— a minimal card with only a title and an action button (at least one ofhero_image,title,actions, orbodyis required).block-kit/tests/blocks/test_card.py— asserts each produced block deep-equals the expected literal.block-kit/README.md— adds a Card bullet (alphabetical) with docs + implementation links.Docs
https://docs.slack.dev/reference/block-kit/blocks/card-block
Notes
CardBlock.icon/CardBlock.hero_imageare typed asOptional[str]inslack_sdk3.42.0, but the documented example (and runtime serialization) uses image element objects. The example passesImageElementto match the docs structure, with a narrow# type: ignore[arg-type]on those two arguments to satisfymypy(the SDK type hint is narrower than the accepted input).Validation
All four CI gates run locally against
slack_sdk==3.42.0(pinned inrequirements.txt):ruff check— passed (All checks passed!)ruff format --diff --check— passed (34 files already formatted)mypy ./**/*.py— passed (Success: no issues found in 34 source files)pytest— passed (34 passed, including the 2 newtest_cardcases)Co-Authored-By: Claude svc-devxp-claude@slack-corp.com