Skip to content

feat(webhook): warn when URL pattern mismatches webhook class - #2688

Draft
zimeg wants to merge 4 commits into
mainfrom
zimeg/webhook-url-mismatch-warning
Draft

feat(webhook): warn when URL pattern mismatches webhook class#2688
zimeg wants to merge 4 commits into
mainfrom
zimeg/webhook-url-mismatch-warning

Conversation

@zimeg

@zimeg zimeg commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a logger to @slack/webhook (@slack/logger as a new dependency, >=4.0.0)
  • IncomingWebhook warns if the URL contains /triggers/ (likely meant for WebhookTrigger)
  • WebhookTrigger warns if the URL contains /services/ (likely meant for IncomingWebhook)
  • Both classes now accept optional logger and logLevel in their constructor options
  • Pattern-based check works for any host (hooks.slack.com, hooks.dev.slack.com, etc.)

Motivation

Users upgrading to v4 of slack-github-action accidentally use webhook-type: webhook-trigger with an incoming webhook URL (or vice versa), causing duplicate deliveries and hangs. This SDK-level warning catches the misconfiguration at construction time regardless of the consumer (GHA, custom scripts, etc.).

Refs: slackapi/slack-github-action#654

Test plan

  • Existing tests pass (39/39)
  • Biome lint clean
  • Build succeeds
  • Add unit tests for the warning (logs when URL mismatches, silent when URL matches)

🤖 Generated with Claude Code

Add a logger to @slack/webhook that warns at construction time when:
- IncomingWebhook receives a URL containing "/triggers/"
- WebhookTrigger receives a URL containing "/services/"

This helps catch misconfiguration that causes duplicate deliveries or
hangs (see #654). Both classes now accept optional `logger` and
`logLevel` options via their defaults/options argument.

Refs: #654

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d33b86c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/webhook Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.17%. Comparing base (626da7a) to head (d33b86c).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2688      +/-   ##
==========================================
+ Coverage   89.11%   89.17%   +0.05%     
==========================================
  Files          65       66       +1     
  Lines       10351    10398      +47     
  Branches      473      478       +5     
==========================================
+ Hits         9224     9272      +48     
+ Misses       1096     1095       -1     
  Partials       31       31              
Flag Coverage Δ
cli-hooks 89.17% <96.29%> (+0.05%) ⬆️
cli-test 89.17% <96.29%> (+0.05%) ⬆️
logger 89.17% <96.29%> (+0.05%) ⬆️
oauth 89.17% <96.29%> (+0.05%) ⬆️
socket-mode 89.17% <96.29%> (+0.05%) ⬆️
web-api 89.17% <96.29%> (+0.05%) ⬆️
webhook 89.17% <96.29%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

zimeg and others added 3 commits August 4, 2026 15:08
…ogger

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant