@slack/web-api
Slack's official Node.js HTTP client for calling any of the 270+ Web API methods, with built-in queuing, retries, pagination, and rate-limit handling.
Repository Health
Technical Analysis
@slack/web-api is the official Node.js client for Slack’s Web API, maintained by Slack Technologies as part of the node-slack-sdk monorepo. It exports a WebClient class with a named, typed method for every public Web API endpoint (chat.postMessage, conversations.list, users.info, and hundreds more), so calls read as web.chat.postMessage({...}) instead of hand-built HTTP requests against Slack’s method catalog.
Beyond simple request/response wrapping, the client handles the operational concerns that come with talking to a rate-limited third-party API at scale: an internal request queue caps concurrency, failed calls are retried with configurable backoff policies, HTTP 429 responses pause the queue and resume automatically once Slack’s retry-after window elapses, and cursor-paginated list methods can be consumed as an async iterator via web.paginate() instead of manually tracking response_metadata.next_cursor. A dedicated filesUploadV2 helper and ChatStreamer class wrap Slack’s newer multi-step file-upload and streaming-message flows behind a single call.
Because the whole SDK is generated from Slack’s API definitions, the request and response argument types stay in lockstep with the platform, giving TypeScript users inline hints for every method’s parameters without leaving their editor. Errors are modeled as a small class hierarchy (WebAPIPlatformError, WebAPIRequestError, WebAPIHTTPError, WebAPIRateLimitedError) rooted in a shared SlackError, so callers can instanceof-check the failure mode instead of parsing string codes.
@slack/web-api is typically installed alongside sibling packages from the same monorepo — @slack/oauth for install flows, @slack/socket-mode or @slack/webhook for receiving events — but it has no dependency on them and works standalone for any app that only needs to call the Web API.
What You Get
- A
WebClientclass with a method for each of Slack’s 270+ Web API endpoints, callable asweb.chat.postMessage(...),web.conversations.list(...), etc., or dynamically viaweb.apiCall(methodName, options). - Automatic request retries with pluggable
retryConfigpolicies (default ~10 retries over 30 minutes), plus automatic pause-and-resume handling for HTTP 429 rate-limit responses. - Cursor pagination built in via
web.paginate(method, options), usable as an async iterator (for await...of) or with a stop/reduce callback pair for functional-style accumulation. - A typed error hierarchy (
WebAPIPlatformError,WebAPIHTTPError,WebAPIRequestError,WebAPIRateLimitedError, all extendingSlackError) so failure handling can branch oninstanceofinstead of string matching. - A
filesUploadV2helper andChatStreamerclass that wrap Slack’s multi-request file-upload and streaming-message-append flows behind single method calls. - Full TypeScript types for every method’s request arguments and response shape, generated to track Slack’s platform API definitions.
Common Use Cases
- Slack bots and apps - posting and updating messages, reacting, and managing channels from a bot token without hand-rolling HTTP calls to Slack.
- Backend integrations - syncing users, channels, or files between Slack and an internal system using the typed method surface and built-in pagination for
*.listendpoints. - Admin and Enterprise Grid tooling - calling
admin.*methods (user provisioning, conversation management, analytics exports) with the same retry/rate-limit handling as any other method. - Custom Slack workflow steps and interactivity - responding to Slack events (typically received via Bolt or a raw event listener) by calling back into the Web API to post results or update UI.
- Streaming/long-running responses - using
chatStream()to append incrementally generated (e.g. LLM-produced) text into a Slack message without re-posting the whole message on every update.
Under The Hood
Architecture
The package is organized around a single WebClient class (WebClient.ts) that extends a generated Methods class (methods.ts, ~2,600 lines) providing one property-per-namespace, method-per-endpoint surface (e.g. client.chat.postMessage) that all funnel into WebClient.apiCall(). apiCall builds the request URL, serializes the body (serializeBody, choosing multipart/form-data when binary content is present, otherwise URL-encoding), routes it through a p-queue-backed makeRequest that enforces maxRequestConcurrency and wraps the actual fetch call in p-retry, and finally normalizes the response in buildResult (including a special path for gzip-encoded analytics-export responses). Pagination (paginate()), file uploads (filesUploadV2, delegating to file-upload.ts), and streaming messages (chatStream(), delegating to chat-stream.ts) are each implemented as focused helpers layered on top of the same apiCall/makeRequest core, so the request pipeline has one entry point regardless of which higher-level feature is used. Runtime warnings (deprecated methods, missing text/fallback on message-posting calls, non-string thread_ts) are attached directly inside apiCall rather than as separate middleware.
Tech Stack
Written in TypeScript and built with tsc against Node >=20, using the platform’s native fetch/FormData/AbortSignal rather than a bundled HTTP library, with a caller-injectable fetch option for proxies or custom transports. Concurrency and retry behavior come from small, focused dependencies: p-queue for the request queue, p-retry (built on retry) for exponential backoff, and eventemitter3 for the rate_limited event. @slack/types and @slack/logger are sibling packages from the same monorepo, pulled in as regular dependencies rather than duplicated. The repo itself is an npm workspaces monorepo (packages/web-api alongside oauth, socket-mode, webhook, etc.) built via a shared scripts/build.sh, linted and formatted with Biome, and documented through TypeDoc with a markdown output plugin.
Code Quality
Tests use Node’s built-in node:test runner (via tsx) rather than a third-party framework, with nock for HTTP mocking and sinon for spies/stubs; WebClient.test.ts, file-upload.test.ts, and instrument.test.ts cover the client’s core request path, file-upload flow, and user-agent instrumentation respectively, and a separate tsd-based suite (test:types) exercises the exported TypeScript types directly. Error handling is explicit and typed throughout — a SlackError base class with per-failure-mode subclasses rather than generic thrown strings or swallowed exceptions — and the codebase is TypeScript-strict with Biome enforcing lint rules and import organization. GitHub Actions run a CI build workflow (ci-build.yml) plus dependency and release-automation workflows on every push, so the test/lint/build path is continuously enforced rather than run only locally.
API Design
The defining ergonomic choice is generating one strongly-typed method per Slack Web API endpoint instead of exposing a single generic request(method, params) call — callers get autocomplete and inline argument documentation for all 270+ methods straight from their editor, while apiCall() remains available underneath for dynamic method names or brand-new endpoints not yet in the generated surface. Getting started requires only new WebClient(token) and a single awaited call; pagination, retries, and rate-limiting are on by default and only need configuration when the defaults don’t fit, which keeps the common path free of boilerplate while still exposing escape hatches (retryConfig, maxRequestConcurrency, custom fetch) for advanced use.
Used by 54 apps in this directory
Apache Maka
AI Agents · AI Development · Developer Tools
An Apache-incubated agent workspace that treats every model call, tool run, and permission decision as an append-only, replayable event log instead of disposable chat history.
Mastra Code
AI Code Assistants
"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.
Metabase
Analytics
The open-source BI platform that lets anyone ask questions and build dashboards without writing SQL — with an embedded analytics SDK and AI-powered query assistant included.
Midday
Invoicing Finance · Productivity
All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.
nao
AI Development · Analytics
Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.
nao
AI Development · Analytics
Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.
NocoDB
Databases · Low Code Platforms · No Code Platforms
Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.
Novu
Developer Tools
Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.
Novu
Developer Tools
Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.