Skip to content

feat: add web api methods chat.postMessage and blocks.validate with example placeholders - #138

Draft
zimeg wants to merge 18 commits into
mainfrom
methods-examples
Draft

feat: add web api methods chat.postMessage and blocks.validate with example placeholders#138
zimeg wants to merge 18 commits into
mainfrom
methods-examples

Conversation

@zimeg

@zimeg zimeg commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds methods to examples with placeholder values for arguments in hopes of quick copies and paste. For now two methods are added:

  • blocks.validate
  • chat.postMessage

These are separated as method "families" for: blocks or chat or conversations and 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:

  • Is "chat-post-message.js" format ideal for these methods? The requests of @slack/web-api are grouped in families and responses use capital casing.
  • Does testing HTTP request values seem excessive? IMHO it's nice confirmation of the packaging of the SDK exports! Extending this to adjacent runtimes might challenge this.

zimeg and others added 13 commits July 13, 2026 17:00
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>
@zimeg zimeg self-assigned this Jul 14, 2026
@zimeg zimeg added the enhancement New feature or request label Jul 14, 2026
@zimeg zimeg changed the title feat: add methods example set with chat.postMessage feat: add web api methods chat.postMessage and blocks.validate with example placeholders Jul 14, 2026
zimeg and others added 5 commits July 14, 2026 22:26
@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant