Skip to content

feat(providers): add webhookUrl override for push-webhook#10695

Open
dakshhadvani19 wants to merge 10 commits intonovuhq:nextfrom
dakshhadvani19:feat/push-webhook-override
Open

feat(providers): add webhookUrl override for push-webhook#10695
dakshhadvani19 wants to merge 10 commits intonovuhq:nextfrom
dakshhadvani19:feat/push-webhook-override

Conversation

@dakshhadvani19
Copy link
Copy Markdown

@dakshhadvani19 dakshhadvani19 commented Apr 14, 2026

What changed? Why was the change needed?

This PR implements a dynamic webhookUrl override for the Push Webhook provider.

The Problem:
Previously, the Push Webhook URL was globally fixed in the integration settings. This restricted developers who needed to send notifications to unique callback URLs for different subscribers or specific triggers (essential for multi-tenant applications).

The Solution:
Introduced a 3-tier priority logic for the webhookUrl:

  1. Trigger Override: URL provided in the overrides object during a trigger call.
  2. Subscriber Credentials: URL stored specifically in the subscriber's push-webhook channel credentials.
  3. Integration Default: Fallback to the dashboard configuration if no overrides are present.

Key Changes:

  • Modified PushWebhookProvider to prioritize bridge/override data.
  • Updated SendMessagePush use-case logic to inject subscriber-level credentials.
  • Updated DTOs in libs/shared to support the optional webhookUrl field.
  • Added comprehensive unit tests for both the provider and the worker logic.
  • Security: Implemented a filter to ensure sensitive subscriber credentials (like HMAC secrets) are stripped before making the external POST request to the webhook recipient.

Screenshots

This is a backend logic change. Unit tests have been added and verified to ensure the priority logic works as expected.


Special notes for your reviewer

  • This addresses a long-standing feature request (similar to logic already available in Chat channels).
  • The implementation is backward-compatible; if no overrides are provided, the system defaults to existing dashboard behavior.
  • I've verified the stripping of sensitive data in the new unit tests to prevent credential leaking.

Note

Medium Risk
Changes push delivery routing by allowing per-subscriber/per-trigger webhookUrl selection, which can affect where notifications are sent and how signatures are generated. Risk is mitigated by explicit priority rules and added tests, but misconfiguration could redirect traffic.

Overview
Adds support for overriding Push Webhook delivery settings via bridgeProviderData, letting webhookUrl (and hmacSecretKey) provided at runtime take precedence over integration config, while ensuring these fields are stripped from the outbound request body.

Updates the worker SendMessagePush flow to inject a subscriber-channel credentials.webhookUrl into bridgeProviderData only when no trigger override is present (trigger override > subscriber credential > integration default), and expands unit tests to cover the priority logic and provider override behavior.

Reviewed by Cursor Bugbot for commit c0532e3. Configure here.

What changed

Push Webhook now supports per-trigger and per-subscriber webhookUrl overrides so push notifications can target different callback URLs instead of a single integration-level URL. Resolution follows a three-tier priority: trigger override > subscriber channel credential > integration default. Subscriber-provided secrets (e.g., HMAC keys) can be used for signature calculation but are stripped from outbound request bodies to avoid leaking sensitive data. This makes routing explicit for multi-tenant or per-subscriber callbacks while preserving backward compatibility.

Affected areas

  • worker: SendMessagePush updated to accept an optional subscriberWebhookUrl, applies subscriber-level webhookUrl into combined overrides via a new helper applySubscriberWebhookUrl, and passes resolved bridgeProviderData into push delivery.
  • providers: PushWebhook provider updated to honor webhookUrl and hmacSecretKey from bridge/override data for request destination and signature computation, and to filter those fields out of the JSON payload sent to target endpoints.
  • shared: DTOs/Swagger for ChannelCredentials.webhookUrl updated to document that webhookUrl applies to chat and push-webhook integrations and can override integration-level URLs.
  • api/dashboard/assets/tests: Tests and assets updated/added to reflect behavior and documentation changes (unit tests and an e2e spec touchpoints).

Key technical decisions

  • Priority order is explicit and immutable: trigger overrides (highest) > subscriber channel credential > integration config (fallback) to avoid ambiguity in routing and signature generation.
  • Bridge/override fields (webhookUrl, hmacSecretKey) are permitted for delivery/signing but are removed from the serialized request body to prevent credential leakage.

Testing

Added unit tests for SendMessagePush webhookUrl injection covering presence/absence and edge cases, and provider tests verifying endpoint override, HMAC override for signature calculation, and that sensitive fields are excluded from the request body; existing e2e/unit test surfaces were also updated where relevant.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 14, 2026

👷 Deploy request for dashboard-v2-novu-staging pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit b798069

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d5a43531-c24b-4a22-9e98-18e8659f0f98

📥 Commits

Reviewing files that changed from the base of the PR and between e1235bf and faf0746.

📒 Files selected for processing (1)
  • apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.spec.ts

📝 Walkthrough

Walkthrough

Introduces subscriber-level webhook URL injection for push delivery: adds exported helper applySubscriberWebhookUrl, extends SendMessagePush.sendMessage to accept an optional subscriberWebhookUrl, updates delivery flow to apply the helper before calling the push handler, and adds tests validating override and request behavior.

Changes

Cohort / File(s) Summary
Send Message Push Implementation & Tests
apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.ts, apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.spec.ts
Added exported applySubscriberWebhookUrl(combinedOverrides, subscriberWebhookUrl?). Extended SendMessagePush.sendMessage(...) signature to accept subscriberWebhookUrl?, compute combinedOverrides once, derive bridgeProviderData via the helper, and pass it to pushHandler.send. Updated tests to cover webhook selection, fallback, empty-string behavior, and preservation of other fields.
Push Webhook Provider Tests
packages/providers/src/lib/push/push-webhook/push-webhook.provider.spec.ts
Added 3 tests ensuring bridgeProviderData overrides provider config for request destination and signature secret, and that bridge-specific fields are omitted from the serialized request body.
Subscriber Channel DTO Docs
libs/application-generic/src/dtos/subscribers/subscriber-channel.ts
Expanded ApiPropertyOptional description for ChannelCredentials.webhookUrl to include "chat and push-webhook integrations" and note subscriber-level override behavior.

Sequence Diagram

sequenceDiagram
    participant Caller as Caller
    participant SendPush as SendMessagePush
    participant Combiner as CombineOverrides
    participant Helper as applySubscriberWebhookUrl
    participant Handler as PushHandler
    participant Provider as PushProvider
    participant Service as ExternalWebhook

    Caller->>SendPush: sendMessage(..., subscriberWebhookUrl?)
    SendPush->>Combiner: combineOverrides(overrides)
    Combiner-->>SendPush: combinedOverrides
    SendPush->>Helper: applySubscriberWebhookUrl(combinedOverrides, subscriberWebhookUrl)
    Helper-->>SendPush: bridgeProviderData
    SendPush->>Handler: pushHandler.send(..., bridgeProviderData)
    Handler->>Provider: sendMessage(bridgeProviderData)
    alt bridgeProviderData.webhookUrl exists
        Provider->>Service: POST to bridgeProviderData.webhookUrl
    else
        Provider->>Service: POST to provider.config.webhookUrl
    end
    Service-->>Provider: Response
    Provider-->>Handler: Result
    Handler-->>SendPush: Delivery result
    SendPush-->>Caller: Outcome
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits format with valid type (feat), valid scope (providers), and a clear lowercase imperative description that accurately reflects the main change: adding webhookUrl override functionality for push-webhook.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dakshhadvani19 dakshhadvani19 changed the title feat: push-webhook override feat(providers): add webhookUrl override for push-webhook Apr 14, 2026
@dakshhadvani19 dakshhadvani19 marked this pull request as ready for review April 14, 2026 05:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.spec.ts`:
- Around line 62-69: The test defines a local helper applySubscriberWebhookUrl
that duplicates production precedence logic, making tests self-referential;
update the tests to exercise the real implementation path instead: either
import/export the shared helper used by SendMessagePush (so tests call the same
function used in production) or remove the local applySubscriberWebhookUrl and
invoke SendMessagePush (or the exported helper it uses) with inputs that
validate webhookUrl precedence behavior; ensure the spec verifies the same
conditions (subscriberWebhookUrl overridden only when
combinedOverrides.webhookUrl is absent) against the production function, not a
duplicated local copy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5aacc8ed-f6dd-4f75-81dd-ea53e0b3cdbe

📥 Commits

Reviewing files that changed from the base of the PR and between 9a25eba and c0532e3.

📒 Files selected for processing (4)
  • apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.spec.ts
  • apps/worker/src/app/workflow/usecases/send-message/send-message-push.usecase.ts
  • libs/application-generic/src/dtos/subscribers/subscriber-channel.ts
  • packages/providers/src/lib/push/push-webhook/push-webhook.provider.spec.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant