feat: post webhooks via the @slack/webhook SDK with action-side retries#630
feat: post webhooks via the @slack/webhook SDK with action-side retries#630zimeg wants to merge 43 commits into
Conversation
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
Retries now live in the @slack/webhook package via retryConfig, matching how the API-method technique passes retryConfig to @slack/web-api. The action maps its 0/5/10/RAPID input to the SDK's exported retry policies. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
Retries now live upstream in
This PR now just passes |
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The action already registered its app metadata with @slack/web-api via addAppMetadata, but webhook requests went out without the action's identifier. @slack/webhook now exports the same addAppMetadata API, so register the package name and version with it too using the shared package.json values. Adds a test covering the webhook registration. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The SDK migration collapsed proxies() to pass any proxy URL straight to HttpsProxyAgent, dropping the http:/https: protocol check that main had. Restore the switch so an unsupported proxy protocol throws the same 'Unsupported URL protocol' error instead of leaking a raw agent failure. Both http: and https: proxies map to a single HttpsProxyAgent; the old axios-only 'proxy: false' branch is unneeded since @slack/webhook sets proxy: false on its own axios instance. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Collapse postIncomingWebhook/postWebhookTrigger into a single post(): construct each client through the config.webhook module namespace, send, and write outputs inline within the type switch, sharing the options and one try/catch. Drops the direct IncomingWebhook/WebhookTrigger imports and the redundant webhook URL type cast. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
The SDK migration (074e58f) dropped two behaviors main had: the guard that throws when no webhook is provided, and the skip that returns undefined (no proxy) when the webhook destination is not HTTPS. Restore both for parity — an HttpsProxyAgent only tunnels HTTPS destinations, so a non-HTTPS webhook should bypass the proxy. Adds a test for the skip. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Each case is the last action in post(), so return makes the intent explicit and guards against fall-through if code is added later. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Restore the payload deep-equal (drinks: coffee / text: hi) and the "response" output assertion in the webhook failure tests that were lost in the axios to @slack/webhook migration. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Restore main's "textt: oops" input and { textt: "oops" } assertion so
the incoming failure test still exercises the malformed-payload case.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Move the non-HTTPS webhook skip test back to its position after the missing-webhook case and restore its original name, matching main's proxies ordering. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Place "sets up the proxy agent for the provided https proxy" ahead of the returns-undefined case to match main's proxies ordering. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Add a test that an http proxy also yields an HttpsProxyAgent (beside the https case) and one asserting post() throws for an unknown webhook type, bringing src/webhook.js to full branch coverage. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Use a bare assert.fail() in the unknown webhook type test. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Bump to @slack/webhook 7.2.0-rc.2 and consume retry policies via the new retryPolicies namespace (webhook.retryPolicies.<policy>), mirroring the @slack/web-api client. Updates src/webhook.js and the retries tests. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Summary
Converts both webhook techniques to the
@slack/webhookSDK and removesaxios/axios-retryas direct dependencies of the action:incoming-webhook→IncomingWebhookclasswebhook-trigger→WebhookTriggerclassRetry behavior (
0/5/10/RAPID) and HTTPS proxy support are preserved, so this is not a regression. Since the webhook SDK classes don't accept aretryConfig(unlikeWebClient), retries run in the action viap-retry, reusing@slack/web-api's named retry policies. Non-retryable responses (4xx other than 429) abort immediately; request errors and 5xx/429 are retried.src/config.jsno longer owns an axios client or builds the webhookUser-Agent— the SDKs set their own. The action still registers app metadata with@slack/web-api.@slack/webhookis pinned to a localfile:../node-slack-sdk/packages/webhookpath for development. It MUST be swapped to a published version (one that exportsWebhookTrigger) before this merges.Notes
@slack/web-apiversion bump in this PR;client.js(the API-method technique) is unchanged and still uses@slack/web-api@7(axios transitively).dist/is rebuilt as part of release, not committed here.Requirements
🤖 Generated with Claude Code