feat(methods): add blocks.validate example - #187
Merged
Conversation
Add a blocks method-family example that validates a Block Kit payload built with typed blocks via @slack/web-api, mirroring the chat.postMessage example. blocks.validate is unauthenticated, so the client is created without a token. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
blocks.validate is unauthenticated, so the example app needs no bot scopes or bot user. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Write the text composition object one property per line to match the repo's block-kit examples (block-kit/src/blocks/section.js et al.), which never inline the text object. Consistent house style for a reference example. 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
Adds a
blocksmethod-family example forblocks.validate, mirroring the existingchatexample so each Slack API method family has a self-contained, runnable demonstration.methods/src/blocks/blocks-validate.jsbuilds blocks with typed Block Kit values and validates them viaclient.blocks.validate({ blocks }), then prints the response.methods/src/blocks/manifest.json+.slack/config for theblocksexample.blockssection inmethods/README.md's "What's on call" list.blocks.validateis unauthenticated, so the client is created without a token (new WebClient()). The method isn't in a published@slack/web-apirelease yet, so this depends on the SDK change in slackapi/node-slack-sdk#2659;package.jsonstays on the published^8.0.0so the repo keeps building.Testing
cd methods && npx @biomejs/biome check src/blocks/blocks-validate.js— clean.tsc --checkJs) against a local build of feat(web-api): add blocks.validate method slackapi/node-slack-sdk#2659: the typedblocksargument is enforced (passing a non-array errors), and the example type-checks clean.Depends on slackapi/node-slack-sdk#2659.
🤖 Generated with Claude Code