The `slack-web-api-client` is a fetch-based, type-safe client library for interacting with the Slack Web API, designed for broad runtime compatibility across environments like Node.js, Deno, and Cloudflare Workers. Currently stable at version 1.1.11, it is part of the `slack-edge` ecosystem and is utilized internally by the `slack-edge` library itself. A key differentiator is its "zero additional dependencies" approach, minimizing install footprint and potential conflicts, which simplifies integration and reduces supply chain risks. It provides strong TypeScript types for all API responses and Block Kit elements, significantly enhancing the developer experience with predictive coding and robust error checking. The project appears to be actively maintained, with updates available via `npm i slack-web-api-client@latest`. Its fetch-based implementation makes it highly portable, a significant advantage over clients relying on Node.js-specific HTTP modules.
npm install slack-web-api-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the SlackAPIClient, configure it, and use it to post a message with Block Kit to a specified Slack channel, including basic error handling.
To handle API failures without exceptions, set `throwSlackAPIError: false` in the client's constructor options: `new SlackAPIClient(token, { throwSlackAPIError: false })`. Alternatively, wrap your API calls in `try...catch` blocks to catch `SlackAPIError` instances.Ensure the `process.env.SLACK_BOT_TOKEN` (or equivalent) environment variable is correctly set with a valid token and that the associated bot or user has the necessary OAuth scopes for the API methods you are calling.
Consult the specific runtime's documentation for handling environment variables. For Deno, refer to the Deno-specific README provided by the library. For Cloudflare Workers, use Worker-native ways to access secrets (e.g., `env.SLACK_BOT_TOKEN`).
Verify that your `SLACK_BOT_TOKEN` environment variable (or hardcoded token) is correctly set and starts with `xoxb-` or `xoxp-`. Ensure your Slack app has the necessary OAuth scopes for the API method being called (e.g., `chat:write` for `chat.postMessage`).
Double-check that `new SlackAPIClient(token)` was called with a valid token. Confirm that the API method path (e.g., `chat.postMessage`) matches the Slack Web API documentation and the client's exposed methods.
No dependency data recorded yet.