Skip to content

feat(methods): add chat.postMessage example - #139

Merged
zimeg merged 11 commits into
mainfrom
methods-typecheck-only
Aug 14, 2026
Merged

feat(methods): add chat.postMessage example#139
zimeg merged 11 commits into
mainfrom
methods-typecheck-only

Conversation

@zimeg

@zimeg zimeg commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

Adds a methods/ chat.postMessage example to the Bolt for JavaScript examples — the first entry in a new methods/ showcase of individual Slack Web API method calls with @slack/web-api.

  • src/chat/chat-post-message.js reads a token from the environment, initializes a WebClient, and calls chat.postMessage.
  • The example is a self-contained script with a manifest.json requesting only chat:write.
  • methods/README.md documents the family and links the implementation; the top-level README lists the new showcase.

The example is validated in CI by tsc --checkJs (payload checked against @slack/web-api's real ChatPostMessageArguments type) and Biome lint/format.

Testing

From methods/src/chat:

export SLACK_TOKEN="xoxb-..."
slack install --environment local
slack run chat-post-message.js

Confirm the message posts to the configured channel.


Supersedes the runtime-test / fetch-stub exploration in #138 (closed).

🤖 Generated with Claude Code

zimeg and others added 5 commits July 14, 2026 16:44
Add a methods/ chat.postMessage example verified by tsc --checkJs + Biome
lint, with no runtime test. The type-check validates the payload against
@slack/web-api's real ChatPostMessageArguments type, catching wrong or
misspelled arguments (e.g. chnnel -> TS2561) without a mock server.

This is an alternative to the fetch-stub 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 use `npm test --if-present` so the
type-check-only methods example (which has no test script) passes CI while
still running lint and check.

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>
Match the runtime-test branch: add @slack/cli-hooks, a .slack/ workspace,
and a chat manifest.json requesting only chat:write. Move scopes out of
the README into the manifest and document the `slack install` flow with
the method's exact docs description.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Move @slack/cli-hooks to stable ^2.0.0 (get-hooks bin unchanged) and remove
skipLibCheck so tsc fully type-checks library declarations by default,
matching block-kit. The tsconfig already scopes include to src only (this
variant has no tests).

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg added 3 commits August 11, 2026 18:55
Move methods/chat/ to methods/src/chat/ and collapse the inner src/
directory so the example sits at methods/src/chat/chat-post-message.js.
Repoint the top-level README to the specific chat.postMessage doc and
implementation path; the per-family README is dropped in favor of the
single methods index.

Replace the tsconfig-driven check with an inline tsc invocation
(tsc --checkJs --noEmit --types node src/**/*.js) and remove
methods/tsconfig.json.
@zimeg zimeg changed the title feat(methods): add chat.postMessage example (typecheck-only) feat(methods): add chat.postMessage example Aug 12, 2026
@zimeg zimeg added new PR only - a new app is being introduced javascript Pull requests that update javascript code labels Aug 12, 2026
@zimeg zimeg self-assigned this Aug 12, 2026
@zimeg zimeg added the documentation Improvements or additions to documentation label Aug 12, 2026
The example reads one variable (SLACK_TOKEN), so 'an environment
variable' is more accurate than the plural.
@zimeg
zimeg marked this pull request as ready for review August 12, 2026 05:36
@zimeg
zimeg requested a review from a team as a code owner August 12, 2026 05:36
zimeg and others added 2 commits August 14, 2026 16:12
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg

zimeg commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

@zimeg
zimeg merged commit 3a8692a into main Aug 14, 2026
7 checks passed
@zimeg
zimeg deleted the methods-typecheck-only branch August 14, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation javascript Pull requests that update javascript code new PR only - a new app is being introduced

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant