feat(methods): add chat.postMessage example - #132
Open
zimeg wants to merge 13 commits into
Open
Conversation
Add a methods/ chat.postMessage example verified by ruff + mypy, with no runtime test. slack_sdk's chat_postMessage has typed keyword arguments, so mypy catches wrong types, missing required args, and misspelled arguments (e.g. chnnel -> "Missing named argument channel") without a mock server. This is an alternative to the mock-server runtime-test approach for side-by-side comparison. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add methods to the CI matrix and treat pytest exit code 5 ("no tests
collected") as success, so the type-check-only methods example (which has
no tests) passes CI while still running ruff and mypy. Real test failures
(exit 1) still fail the build.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Match the runtime branch: add a chat manifest.json requesting only chat:write, move the scope out of the README into the manifest, and use the method's exact docs description. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg
commented
Jul 31, 2026
Comment on lines
+34
to
+35
| # Exit code 5 = "no tests collected" (e.g. type-check-only showcases); treat as success. | ||
| pytest -v || [ $? -eq 5 ] |
Member
Author
There was a problem hiding this comment.
Mirror the bolt-js-examples methods README: tighten the intro, add a 'Making a request' walkthrough, and rename 'What's on display' to 'What's on call'. Adapt the run flow to Python — the walkthrough runs from the package root (cd methods) so 'python -m src.chat.chat_post_message' resolves.
Flatten the example into a top-level script matching the bolt-js counterpart: read the token, initialize the client, call the method. Drops the example01() wrapper, __main__ block, and the now-unused SlackResponse import.
# Conflicts: # .github/workflows/test.yml
The CI 'Run tests' step invokes pytest, but methods only pinned mypy, ruff, and slack_sdk — so pytest failed with 'command not found' (exit 127), which the '|| [ $? -eq 5 ]' no-tests guard doesn't catch. Install pytest (matching block-kit's pin) so it runs, collects no tests, and exits 5 — which the guard treats as success.
Revert adding pytest to methods requirements; instead gate the pytest invocation on a tests/ directory. methods is type-check-only and ships no tests, so pytest was failing with 'command not found'. Guarding on [ -d tests ] skips it cleanly for methods while still running tests (and surfacing real failures) for showcases that have them.
Match the methods entry to its README: 'An interface for querying information from and enacting change in a Slack workspace' rather than the outdated 'Individual Slack Web API method calls' phrasing.
The example reads one variable (SLACK_TOKEN), so 'an environment variable' is more accurate than the plural.
zimeg
commented
Aug 12, 2026
zimeg
left a comment
Member
Author
There was a problem hiding this comment.
👁️🗨️ A neartime is arrived!
| { | ||
| "display_information": { | ||
| "name": "Slack API Methods", | ||
| "description": "Example implementations to call \"chat\" methods" |
Member
Author
There was a problem hiding this comment.
🗣️ note: We prefer method names in description to avoid character limits.
| @@ -0,0 +1,21 @@ | |||
| # Methods | |||
|
|
|||
| An interface for querying information from and enacting change in a Slack workspace. | |||
Member
Author
There was a problem hiding this comment.
🤓 note: Most wording is gathered from docs upstream if found.
Co-authored-by: Eden Zimbelman <zim@o526.net>
zimeg
marked this pull request as ready for review
August 12, 2026 05:35
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
methods/chat.postMessageexample to the Bolt for Python examples — the first entry in a newmethods/showcase of individual Slack Web API method calls with theslack_sdkWebClient.src/chat/chat_post_message.pyreads a token from the environment, initializes aWebClient, and callschat_postMessage.manifest.jsonrequesting onlychat:write.methods/README.mddocuments the family and links the implementation; the top-level README lists the new showcase.The example is validated in CI by
ruff(lint/format) andmypy—slack_sdk's typed keyword arguments catch wrong types, missing required args, and misspelled arguments at check time.Testing
From
methods/:Confirm the message posts to the configured channel.
Supersedes the runtime-test / mock-server exploration in #131 (closed).
🤖 Generated with Claude Code