@slack/webhook@8.0.0
Major Changes
-
fc98c8c: Drop Node.js 18 support. The minimum supported Node.js version is now 20.
-
fc98c8c: Restructured error classes to use proper
Errorsubclasses extending a newSlackWebhookErrorbase class.Breaking changes to
IncomingWebhookHTTPError:- The
originalproperty has been removed. HTTP response details are now direct properties:statusCode: numberstatusMessage: stringbody: string
- Migrate from
error.original.response.statustoerror.statusCode,error.original.response.datatoerror.body, etc.
Breaking changes to
IncomingWebhookRequestError:- The
originalproperty is now a standardError(previously it was anAxiosError). The original error is also available via the standardcauseproperty.
Removed factory functions (use
newwith the corresponding class instead):requestErrorWithOriginal()→new IncomingWebhookRequestError(original)httpErrorWithOriginal()→new IncomingWebhookHTTPError(statusCode, statusMessage, body)errorWithCode()— Use the specific error class directly.
Migration: Replace
if (error.code === ErrorCode.HTTPError)withif (error instanceof IncomingWebhookHTTPError). You can also catch all webhook errors withif (error instanceof SlackWebhookError).The
CodedErrorinterface is deprecated — useinstanceofchecks with theSlackWebhookErrorbase class or specific error subclasses instead. - The
-
fc98c8c: Replaced
axioswith the standard Fetch API for HTTP transport.Removed options from
IncomingWebhookDefaultArguments:agent— Use the newfetchoption to provide a custom fetch implementation with proxy or TLS support. For proxies, prefer the built-inhttp.setGlobalProxyFromEnv()orNODE_USE_ENV_PROXY=1(Node.js 24+). For advanced use cases:import { fetch, Agent } from "undici"; const webhook = new IncomingWebhook(url, { fetch: (url, init) => fetch(url, { ...init, dispatcher: new Agent({ connect: { ca: myCA } }), }), });
The
axiosdependency has been removed. The default fetch implementation isglobalThis.fetch(available in Node.js 20+). Thetimeoutoption remains available and is implemented viaAbortController.
Minor Changes
-
fc98c8c: feat: add
WebhookTriggerclass for Workflow Builder triggers and opt-in retries forIncomingWebhookandWebhookTriggerWebhookTriggersurfaces its ownWebhookTriggerHTTPErrorandWebhookTriggerRequestError(subclasses ofSlackWebhookError), so trigger failures can be distinguished fromIncomingWebhookfailures viainstanceof.
Patch Changes
- Updated dependencies [fc98c8c]
- @slack/types@3.0.0