Skip to content

Commit 6ae220a

Browse files
authored
Merge branch 'main' into feat/block-kit-data-table-example
2 parents 94dab85 + 3e3d091 commit 6ae220a

151 files changed

Lines changed: 4890 additions & 785 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/dependabot.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,45 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7+
cooldown:
8+
default-days: 7
79
- package-ecosystem: "pip"
810
directory: "ai/slackbot-mcp-client/no-auth"
911
schedule:
1012
interval: "daily"
13+
cooldown:
14+
default-days: 7
15+
exclude:
16+
- "slack*"
1117
- package-ecosystem: "pip"
1218
directory: "ai/slackbot-mcp-client/rich-responses/mcp-apps"
1319
schedule:
1420
interval: "daily"
21+
cooldown:
22+
default-days: 7
23+
exclude:
24+
- "slack*"
1525
- package-ecosystem: "pip"
1626
directory: "ai/slackbot-mcp-client/slack-identity"
1727
schedule:
1828
interval: "daily"
29+
cooldown:
30+
default-days: 7
31+
exclude:
32+
- "slack*"
1933
- package-ecosystem: "pip"
2034
directory: "block-kit"
2135
schedule:
2236
interval: "daily"
37+
cooldown:
38+
default-days: 7
39+
exclude:
40+
- "slack*"
41+
- package-ecosystem: "pip"
42+
directory: "methods"
43+
schedule:
44+
interval: "daily"
45+
cooldown:
46+
default-days: 7
47+
exclude:
48+
- "slack*"

‎.github/workflows/test.yml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
test:
99
name: "pytest@python3.14"
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
1113
strategy:
1214
fail-fast: false
1315
matrix:
@@ -16,11 +18,14 @@ jobs:
1618
- "ai/slackbot-mcp-client/rich-responses/mcp-apps"
1719
- "ai/slackbot-mcp-client/slack-identity"
1820
- "block-kit"
21+
- "methods"
1922
steps:
2023
- name: Checkout code
21-
uses: actions/checkout@v7
24+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25+
with:
26+
persist-credentials: false
2227
- name: Install Python
23-
uses: actions/setup-python@v7
28+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
2429
with:
2530
python-version: "3.14"
2631
- name: Run tests
@@ -30,4 +35,4 @@ jobs:
3035
ruff check
3136
ruff format --diff --check
3237
mypy .
33-
pytest -v
38+
if [ -d tests ]; then pytest -v; fi

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ This collections of examples highlights features of a Slack app in the language
66

77
- **[AI in Slack](./ai)**: Agent experiences and MCP features in an interactive conversation interface.
88
- **[Block Kit](./block-kit)**: The framework of visual components arranged to create app layouts.
9+
- **[Methods](./methods)**: An interface for querying information from and enacting change in a Slack workspace.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
httpx2==2.9.1
2-
mcp==2.0.0
3-
mypy==2.3.0
1+
httpx2==2.13.1
2+
mcp==2.2.0
3+
mypy==2.3.1
44
pytest==9.1.1
5-
ruff==0.16.1
5+
ruff==0.16.9
66
slack_bolt==1.30.0
77
slack_cli_hooks==0.3.0
8-
slack_sdk==3.43.0
9-
starlette==1.3.1
10-
uvicorn==0.52.0
8+
slack_sdk==3.45.0
9+
starlette==1.7.0
10+
uvicorn==0.54.0
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
httpx2==2.9.1
2-
mcp==2.0.0
3-
mypy==2.3.0
1+
httpx2==2.13.1
2+
mcp==2.2.0
3+
mypy==2.3.1
44
pytest==9.1.1
5-
ruff==0.16.1
5+
ruff==0.16.9
66
slack_bolt==1.30.0
77
slack_cli_hooks==0.3.0
8-
slack_sdk==3.43.0
9-
starlette==1.3.1
10-
uvicorn==0.52.0
8+
slack_sdk==3.45.0
9+
starlette==1.7.0
10+
uvicorn==0.54.0
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
httpx2==2.9.1
2-
mcp==2.0.0
3-
mypy==2.3.0
1+
httpx2==2.13.1
2+
mcp==2.2.0
3+
mypy==2.3.1
44
pytest==9.1.1
5-
ruff==0.16.1
5+
ruff==0.16.9
66
slack_bolt==1.30.0
77
slack_cli_hooks==0.3.0
8-
slack_sdk==3.43.0
9-
starlette==1.3.1
10-
uvicorn==0.52.0
8+
slack_sdk==3.45.0
9+
starlette==1.7.0
10+
uvicorn==0.54.0

‎block-kit/AGENTS.md‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Adding a Block Example
2+
3+
A block example is **code-complete** when all four of these are present:
4+
5+
1. Example file
6+
2. Test file
7+
3. README entry
8+
4. Correct docstring
9+
10+
## Example file
11+
12+
Create `src/blocks/{type}.py`:
13+
14+
```python
15+
from slack_sdk.models.blocks import {Type}Block
16+
from slack_sdk.models.blocks.basic_components import MarkdownTextObject, PlainTextObject
17+
from slack_sdk.models.blocks.block_elements import ButtonElement, ImageElement
18+
19+
20+
def example01() -> {Type}Block:
21+
"""
22+
{Description from docs page — must match exactly}.
23+
https://docs.slack.dev/reference/block-kit/blocks/{type}-block/
24+
25+
{Brief description of this specific example}.
26+
"""
27+
block = {Type}Block(
28+
# fields here
29+
)
30+
return block
31+
```
32+
33+
Rules:
34+
- One file per block type in `src/blocks/`
35+
- Each example is a module-level function returning the block type
36+
- Functions named `example01()`, `example02()`, etc. with return type annotation
37+
- Import blocks from `slack_sdk.models.blocks`
38+
- Import text objects from `slack_sdk.models.blocks.basic_components`
39+
- Import elements from `slack_sdk.models.blocks.block_elements`
40+
- The docstring first line must match the docs page `description` field exactly (found in the page's YAML frontmatter)
41+
42+
## Test file
43+
44+
Create `tests/blocks/test_{type}.py`:
45+
46+
```python
47+
import json
48+
49+
from src.blocks import {type}
50+
51+
52+
def test_example01():
53+
block = {type}.example01()
54+
actual = block.to_dict()
55+
expected = {
56+
"type": "{type}",
57+
# fields matching the docs JSON example
58+
}
59+
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)
60+
```
61+
62+
The expected dict must match the docs page JSON example exactly (minus the outer `"blocks": [...]` wrapper).
63+
64+
## README entry
65+
66+
Add an entry to `block-kit/README.md` in alphabetical order under `### Blocks`:
67+
68+
```markdown
69+
- **[{Name}](https://docs.slack.dev/reference/block-kit/blocks/{type}-block)**: {Description matching docs}. [Implementation](./src/blocks/{type}.py).
70+
```
71+
72+
The description must match the docs page `description` field exactly.
73+
74+
## Lint and verify
75+
76+
```bash
77+
cd block-kit
78+
ruff check src/blocks/{type}.py tests/blocks/test_{type}.py
79+
ruff format --check src/blocks/{type}.py tests/blocks/test_{type}.py
80+
pytest tests/blocks/test_{type}.py
81+
```
82+
83+
All must pass. Use `ruff format` (without `--check`) to auto-fix formatting.

‎block-kit/README.md‎

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Read the [docs](https://docs.slack.dev/block-kit/) to learn concepts behind thes
99
### Blocks
1010

1111
- **[Actions](https://docs.slack.dev/reference/block-kit/blocks/actions-block)**: Holds multiple interactive elements. [Implementation](./src/blocks/actions.py).
12+
- **[Alert](https://docs.slack.dev/reference/block-kit/blocks/alert-block)**: Displays alerts, warnings, and informational messages. [Implementation](./src/blocks/alert.py).
13+
- **[Card](https://docs.slack.dev/reference/block-kit/blocks/card-block)**: Displays content in a card. [Implementation](./src/blocks/card.py).
14+
- **[Carousel](https://docs.slack.dev/reference/block-kit/blocks/carousel-block)**: Displays related card blocks in a horizontally-scrolling container. [Implementation](./src/blocks/carousel.py).
15+
- **[Container](https://docs.slack.dev/reference/block-kit/blocks/container-block)**: A general-purpose wrapper for grouping child blocks together, with a configurable size. [Implementation](./src/blocks/container.py).
1216
- **[Context](https://docs.slack.dev/reference/block-kit/blocks/context-block)**: Provides contextual info, which can include both images and text. [Implementation](./src/blocks/context.py).
1317
- **[Context actions](https://docs.slack.dev/reference/block-kit/blocks/context-actions-block)**: Displays actions as contextual info, which can include both feedback buttons and icon buttons. [Implementation](./src/blocks/context_actions.py).
1418
- **[Data table](https://docs.slack.dev/reference/block-kit/blocks/data-table-block)**: Displays rich tables that support pagination, sorting, filtering, and interactivity. [Implementation](./src/blocks/data_table.py).
@@ -19,7 +23,56 @@ Read the [docs](https://docs.slack.dev/block-kit/) to learn concepts behind thes
1923
- **[Input](https://docs.slack.dev/reference/block-kit/blocks/input-block)**: Collects information from users via elements. [Implementation](./src/blocks/input.py).
2024
- **[Markdown](https://docs.slack.dev/reference/block-kit/blocks/markdown-block)**: Displays formatted markdown. [Implementation](./src/blocks/markdown.py).
2125
- **[Plan](https://docs.slack.dev/reference/block-kit/blocks/plan-block)**: Displays a collection of related tasks. [Implementation](./src/blocks/plan.py).
22-
- **[Rich text](https://docs.slack.dev/reference/block-kit/blocks/rich-text-block)**: Displays formatted, structured representation of text. [Implementation](./src/blocks/rich_text.py).
2326
- **[Section](https://docs.slack.dev/reference/block-kit/blocks/section-block)**: Displays text, possibly alongside elements. [Implementation](./src/blocks/section.py).
27+
- **[Table](https://docs.slack.dev/reference/block-kit/blocks/table-block)**: Displays structured information in a table. [Implementation](./src/blocks/table.py).
2428
- **[Task card](https://docs.slack.dev/reference/block-kit/blocks/task-card-block)**: Displays a single task, representing a single action. [Implementation](./src/blocks/task_card.py).
2529
- **[Video](https://docs.slack.dev/reference/block-kit/blocks/video-block)**: Displays an embedded video player. [Implementation](./src/blocks/video.py).
30+
31+
### Block elements
32+
33+
- **[Broadcast](https://docs.slack.dev/reference/block-kit/block-elements/broadcast-element)**: Displays a broadcast mention such as here, channel, or everyone. [Implementation](./src/elements/broadcast.py).
34+
- **[Button](https://docs.slack.dev/reference/block-kit/block-elements/button-element)**: Allows users a direct path to performing basic actions. [Implementation](./src/elements/button.py).
35+
- **[Channel](https://docs.slack.dev/reference/block-kit/block-elements/channel-element)**: Renders as a mention of a channel. [Implementation](./src/elements/channel.py).
36+
- **[Checkboxes](https://docs.slack.dev/reference/block-kit/block-elements/checkboxes-element)**: Allows users to choose multiple items from a list of options. [Implementation](./src/elements/checkboxes.py).
37+
- **[Color](https://docs.slack.dev/reference/block-kit/block-elements/color-element)**: Displays a color swatch from a hex value. [Implementation](./src/elements/color.py).
38+
- **[Date](https://docs.slack.dev/reference/block-kit/block-elements/date-element)**: Displays a formatted, localized date. [Implementation](./src/elements/date.py).
39+
- **[Date picker](https://docs.slack.dev/reference/block-kit/block-elements/date-picker-element)**: Allows users to select a date from a calendar style UI. [Implementation](./src/elements/date_picker.py).
40+
- **[Datetime picker](https://docs.slack.dev/reference/block-kit/block-elements/datetime-picker-element)**: Allows users to select both a date and a time of day. [Implementation](./src/elements/datetime_picker.py).
41+
- **[Email input](https://docs.slack.dev/reference/block-kit/block-elements/email-input-element)**: Allows user to enter an email into a single-line field. [Implementation](./src/elements/email_input.py).
42+
- **[Emoji](https://docs.slack.dev/reference/block-kit/block-elements/emoji-element)**: Displays an emoji. [Implementation](./src/elements/emoji.py).
43+
- **[Feedback buttons](https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element)**: Buttons to indicate positive or negative feedback. [Implementation](./src/elements/feedback_buttons.py).
44+
- **[File input](https://docs.slack.dev/reference/block-kit/block-elements/file-input-element)**: Allows user to upload files. [Implementation](./src/elements/file_input.py).
45+
- **[Icon button](https://docs.slack.dev/reference/block-kit/block-elements/icon-button-element)**: An icon button to perform actions. [Implementation](./src/elements/icon_button.py).
46+
- **[Image](https://docs.slack.dev/reference/block-kit/block-elements/image-element)**: Displays an image as part of a larger block of content. [Implementation](./src/elements/image.py).
47+
- **[Link](https://docs.slack.dev/reference/block-kit/block-elements/link-element)**: Displays a hyperlink. [Implementation](./src/elements/link.py).
48+
- **[Multi-select menu](https://docs.slack.dev/reference/block-kit/block-elements/multi-select-menu-element)**: Allows users to select multiple items from a list of options. [Implementation](./src/elements/multi_select_menu.py).
49+
- **[Number input](https://docs.slack.dev/reference/block-kit/block-elements/number-input-element)**: Allows user to enter a number into a single-line field. [Implementation](./src/elements/number_input.py).
50+
- **[Overflow menu](https://docs.slack.dev/reference/block-kit/block-elements/overflow-menu-element)**: Allows users to press a button to view a list of options. [Implementation](./src/elements/overflow_menu.py).
51+
- **[Plain-text input](https://docs.slack.dev/reference/block-kit/block-elements/plain-text-input-element)**: Allows users to enter freeform text data into a single-line or multi-line field. [Implementation](./src/elements/plain_text_input.py).
52+
- **[Radio button group](https://docs.slack.dev/reference/block-kit/block-elements/radio-button-group-element)**: Allows users to choose one item from a list of possible options. [Implementation](./src/elements/radio_buttons.py).
53+
- **[Rich text input](https://docs.slack.dev/reference/block-kit/block-elements/rich-text-input-element)**: Allows users to enter formatted text in a WYSIWYG composer, offering the same messaging writing experience as in Slack. [Implementation](./src/elements/rich_text_input.py).
54+
- **[Rich text list](https://docs.slack.dev/reference/block-kit/block-elements/rich-text-list-element)**: Displays a list of rich text items. [Implementation](./src/elements/rich_text_list.py).
55+
- **[Rich text preformatted](https://docs.slack.dev/reference/block-kit/block-elements/rich-text-preformatted-element)**: Displays a preformatted rich text element. [Implementation](./src/elements/rich_text_preformatted.py).
56+
- **[Rich text quote](https://docs.slack.dev/reference/block-kit/block-elements/rich-text-quote-element)**: Displays a rich text quote block. [Implementation](./src/elements/rich_text_quote.py).
57+
- **[Rich text section](https://docs.slack.dev/reference/block-kit/block-elements/rich-text-section-element)**: A section element that holds rich text elements. [Implementation](./src/elements/rich_text_section.py).
58+
- **[Select menu](https://docs.slack.dev/reference/block-kit/block-elements/select-menu-element)**: Allows users to choose an option from a drop down menu. [Implementation](./src/elements/select_menu.py).
59+
- **[Team](https://docs.slack.dev/reference/block-kit/block-elements/team-element)**: Renders as a mention of a workspace or team. [Implementation](./src/elements/team.py).
60+
- **[Text](https://docs.slack.dev/reference/block-kit/block-elements/text-element)**: Displays text, optionally with styling. [Implementation](./src/elements/text.py).
61+
- **[Time picker](https://docs.slack.dev/reference/block-kit/block-elements/time-picker-element)**: Allows users to enter numerical data into a single-line field. [Implementation](./src/elements/time_picker.py).
62+
- **[URL input](https://docs.slack.dev/reference/block-kit/block-elements/url-input-element)**: Allows user to enter a URL into a single-line field. [Implementation](./src/elements/url_input.py).
63+
- **[URL source](https://docs.slack.dev/reference/block-kit/block-elements/url-source-element)**: Displays a URL source for referencing within a task card block. [Implementation](./src/elements/url_source.py).
64+
- **[User](https://docs.slack.dev/reference/block-kit/block-elements/user-element)**: Renders as a mention of a user. [Implementation](./src/elements/user.py).
65+
- **[Usergroup](https://docs.slack.dev/reference/block-kit/block-elements/usergroup-element)**: Renders as a mention of a user group. [Implementation](./src/elements/usergroup.py).
66+
- **[Workflow button](https://docs.slack.dev/reference/block-kit/block-elements/workflow-button-element)**: Allows users to run a link trigger with customizable inputs. [Implementation](./src/elements/workflow_button.py).
67+
68+
### Composition objects
69+
70+
- **[Confirmation dialog](https://docs.slack.dev/reference/block-kit/composition-objects/confirmation-dialog-object)**: Defines a dialog that adds a confirmation step to interactive elements. [Implementation](./src/compositions/confirmation_dialog.py).
71+
- **[Conversation filter](https://docs.slack.dev/reference/block-kit/composition-objects/conversation-filter-object)**: Defines a filter for the list of options in a conversation selector menu. [Implementation](./src/compositions/conversation_filter.py).
72+
- **[Dispatch action configuration](https://docs.slack.dev/reference/block-kit/composition-objects/dispatch-action-configuration-object)**: Defines when a plain-text input element will return a `block_actions` interaction payload. [Implementation](./src/compositions/dispatch_action_configuration.py).
73+
- **[Option group](https://docs.slack.dev/reference/block-kit/composition-objects/option-group-object)**: Defines a way to group options in a menu. [Implementation](./src/compositions/option_group.py).
74+
- **[Option](https://docs.slack.dev/reference/block-kit/composition-objects/option-object)**: Defines a single item in a number of item selection elements. [Implementation](./src/compositions/option.py).
75+
- **[Slack file](https://docs.slack.dev/reference/block-kit/composition-objects/slack-file-object)**: Defines an object containing Slack file information to be used in an image block or image element. [Implementation](./src/compositions/slack_file.py).
76+
- **[Text](https://docs.slack.dev/reference/block-kit/composition-objects/text-object)**: Defines an object containing some text. [Implementation](./src/compositions/text.py).
77+
- **[Trigger](https://docs.slack.dev/reference/block-kit/composition-objects/trigger-object)**: Defines an object containing trigger information. [Implementation](./src/compositions/trigger.py).
78+
- **[Workflow](https://docs.slack.dev/reference/block-kit/composition-objects/workflow-object)**: Defines an object containing workflow information. [Implementation](./src/compositions/workflow.py).

‎block-kit/requirements.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mypy==2.3.0
1+
mypy==2.3.1
22
pytest==9.1.1
3-
ruff==0.16.1
4-
slack_sdk==3.43.0
3+
ruff==0.16.9
4+
slack_sdk==3.45.0

‎block-kit/src/blocks/alert.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from slack_sdk.models.blocks import AlertBlock
2+
from slack_sdk.models.blocks.basic_components import MarkdownTextObject
3+
4+
5+
def example01() -> AlertBlock:
6+
"""
7+
Displays alerts, warnings, and informational messages.
8+
https://docs.slack.dev/reference/block-kit/blocks/alert-block/
9+
10+
An informational alert.
11+
"""
12+
block = AlertBlock(
13+
text=MarkdownTextObject(text="The work is mysterious and important."),
14+
level="info",
15+
)
16+
return block

0 commit comments

Comments
 (0)