feat(methods): add chat.postMessage example - #48
Draft
zimeg wants to merge 9 commits into
Draft
Conversation
Add a methods/ chat.postMessage example verified by compilation alone, with no MockWebServer test. Because chatPostMessage and its request builder are strongly typed, javac catches wrong or misspelled arguments (e.g. .chnnel(...) -> cannot find symbol) at compile time without a mock server. This is an alternative to the MockWebServer runtime-test approach for side-by-side comparison. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add the methods example module to the CI matrix. The compile-only example has no test class; `mvn test` compiles it and runs zero tests, so CI verifies it builds and passes spotless. 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>
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'. Keep the Maven layout and run command intact — the walkthrough runs from the project root (cd methods) where 'mvn compile exec:java' resolves.
The flexmark markdown formatter (spotless-maven-plugin) requires the file to end with a blank line; the mirrored README ended on the content line, failing 'spotless:check' in CI.
Flatten the example to mirror the bolt-js counterpart: perform the call flow directly in main() rather than delegating to example01(). Java still requires the class and main shell, but the body now reads top-to-bottom — read the token, initialize the client, call the method. Drops the now-unused ChatPostMessageResponse import.
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.
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 Java examples — the first entry in a newmethods/showcase of individual Slack Web API method calls withslack-api-client.src/main/java/chat/ChatPostMessage.javareads a token from the environment, initializes aMethodsClient, builds aChatPostMessageRequest, and callschatPostMessagedirectly inmain.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 compilation and Spotless (Palantir) formatting — the strongly-typed
ChatPostMessageRequestbuilder catches wrong or misspelled arguments at compile time.Testing
From
methods/:Confirm the message posts to the configured channel.
Supersedes the runtime-test / MockWebServer exploration in #47 (closed).
Co-Authored-By: Claude svc-devxp-claude@slack-corp.com