feat: add web api methods chat.postMessage and blocks.validate with example placeholders - #138
Draft
zimeg wants to merge 18 commits into
Draft
feat: add web api methods chat.postMessage and blocks.validate with example placeholders#138zimeg wants to merge 18 commits into
zimeg wants to merge 18 commits into
Conversation
Add shared package.json (ESM, @slack/web-api v8 RC, lint/check/test scripts), biome.json, .gitignore, and an index README for the new methods/ example set. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add a runnable chat.postMessage example, a fetch-stub test asserting the exact request URL and body, and a chat family README documenting the required chat:write scope. Also add methods/tsconfig.json (enables checkJs with include globs) and fix the check script to run `tsc -p tsconfig.json`, since npm does not expand the previous inline `**` globs and left type-checking inert. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add the methods/ example set to the repo README's demonstrations list and to the JS examples CI matrix so it is linted, type-checked, and tested on every push. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Adds a new blocks/ family with a blocks.validate example using client.apiCall since blocks.validate is not yet a typed method in @slack/web-api@8.0.0-rc.2. Includes the implementation, a fetch-stub test, and a README. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add the blocks.validate example to the methods/ index README so the new blocks family is discoverable alongside chat. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Strip the explanatory comments from the chat.postMessage and blocks.validate fetch-stub tests; the assertions are self-explanatory. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Rename the it() case to "sends" (the describe already names the method), and format the blocks.validate payload multi-line for readability. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Inline the expected blocks payload directly into the deepStrictEqual, and remove the assert.ok description string in both method tests. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Move assert.ok(init) to just before the body assertion and inline the URLSearchParams decode directly into deepStrictEqual in both method tests. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Tighten the assertion block in both method tests. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Rework the methods index and family READMEs to match the house style used by block-kit and ai: matching one-line description, a "Read the docs" link, a "What's on display" bullet list with [Implementation] links, and a "Running an example" section instead of the ad hoc scopes tables. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Pass the blocks payload directly into apiCall, matching the inline style of the chat.postMessage example, instead of a separate const. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Remove the inline comment explaining the apiCall escape hatch; the blocks README already covers why blocks.validate uses client.apiCall. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@slack/web-api v8 is now GA; move off the 8.0.0-rc.2 release candidate to the stable ^8.0.0 range, matching the caret style used by block-kit. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add a per-family manifest.json to each method family requesting only that family's scopes (chat -> chat:write; blocks -> none), delivering the "no god apps" goal as runnable app config. Move scope documentation out of the README bullets into the manifest, and use the methods' exact docs descriptions. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Turn each method family into a self-contained Slack CLI app: add @slack/cli-hooks, a per-family .slack/ workspace (config + hooks, with local state gitignored), and a manifest.json requesting only that family's scopes (chat -> chat:write; blocks -> none). This delivers the "no god apps" goal as runnable, minimally-scoped app config. READMEs use the methods' exact docs descriptions and document the `slack install` flow. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Move @slack/cli-hooks to the stable ^2.0.0 (the get-hooks bin is unchanged, so .slack/hooks.json still works). Set skipLibCheck: false so tsc fully type-checks the SDK's declarations too — verified the @slack/web-api v8 and @types/node types pass cleanly. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Remove the skipLibCheck option entirely; it defaults to false, so tsc fully type-checks library declarations — matching block-kit (which sets no tsconfig and relies on the same default). The example type-checks against the real SDK declarations, which matters for trustworthy documentation. 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
This PR adds
methodsto examples with placeholder values for arguments in hopes of quick copies and paste. For now two methods are added:blocks.validatechat.postMessageThese are separated as method "families" for:
blocksorchatorconversationsand such. All methods share project files such as linting and dependencies. App specific files existing within each of the method families for a separate app manifest scope definition. Unit tests stub "fetch" exist aside each method - this requires the RC now available as "@v8".Notes
Super open to opinion on the following uncertain ideas:
@slack/web-apiare grouped in families and responses use capital casing.