Skip to content

feat(providers): Add Pushwoosh push notification provider#9813

Open
dineshingale wants to merge 3 commits intonovuhq:nextfrom
dineshingale:feat/add-pushwoosh-provider
Open

feat(providers): Add Pushwoosh push notification provider#9813
dineshingale wants to merge 3 commits intonovuhq:nextfrom
dineshingale:feat/add-pushwoosh-provider

Conversation

@dineshingale
Copy link

Description

This PR adds initial support for Pushwoosh as a push notification provider in Novu.

Changes

  • Added Pushwoosh to PushProviderIdEnum
  • Created PushwooshPushProvider class following existing provider patterns
  • Added provider credentials configuration (API Access Token and Application Code)
  • Registered Pushwoosh in the push providers list
  • Added basic test file structure
  • Updated all necessary exports

Related Issue

Closes #1907

Implementation Status

This is an initial implementation that provides the foundation for Pushwoosh integration:

  • Provider structure and TypeScript types are complete
  • Configuration and credentials setup is ready
  • The actual Pushwoosh API integration is marked with TODO and requires:
    • Implementation of the sendMessage method using Pushwoosh REST API
    • Proper error handling
    • Additional test coverage

Testing

  • Basic provider instantiation test included
  • Ready for integration testing once API implementation is complete

Notes

  • Follows the same pattern as other push providers (FCM, APNS, etc.)
  • Uses standard Novu provider base classes
  • Logo file will need to be added to assets

- Add Pushwoosh to PushProviderIdEnum
- Create PushwooshPushProvider class with basic structure
- Add provider credentials configuration (API key and Application Code)
- Register Pushwoosh in push providers list
- Add basic test file for provider

This addresses issue novuhq#1907 by creating the foundation for Pushwoosh integration.
The provider includes proper TypeScript types and follows the existing provider pattern.

Note: Full API implementation is pending and marked with TODO comments.
@netlify
Copy link

netlify bot commented Jan 9, 2026

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

Visit the deploys page to approve it

Name Link
🔨 Latest commit c31db73

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

Walkthrough

A new Pushwoosh integration was added: a PushwooshPushProvider class (with constructor accepting applicationId and apiKey) and a PushwooshHandler were introduced and the handler was registered in the PushFactory. PushProviderIdEnum gained a Pushwoosh member, push provider credentials (API Access Token and Application Code) were added, the provider was added to the pushProviders list and exported, and a unit test verifies instantiation and that sendMessage currently throws a not-implemented error.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR provides the foundational structure for Pushwoosh integration as required by #1907, but does not fully implement the advanced architecture with modularity and command mapping requested in the issue. This PR establishes the base Pushwoosh provider structure. Issue #1907 requests advanced architectural improvements (modular functions, command mapping, monitor creation) that should be addressed in follow-up PRs once the foundation is merged.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main addition of this PR - introducing Pushwoosh as a new push notification provider.
Description check ✅ Passed The description clearly relates to the changeset, explaining the addition of Pushwoosh provider with details on changes, implementation status, and next steps.
Out of Scope Changes check ✅ Passed All changes are directly related to adding Pushwoosh provider support: provider implementation, configuration, exports, handler registration, and UI integration. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

Copy link
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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/shared/src/types/providers.ts (1)

140-150: Pushwoosh enum member is missing from two critical downstream locations.

The new enum member is properly added to packages/shared/src/types/providers.ts and listed in the provider configurations, but two critical files must be updated:

  1. packages/framework/src/shared.ts: The PushProviderIdEnum definition (lines 180–188) does not include Pushwoosh = 'pushwoosh', causing a type mismatch between the shared and framework packages.

  2. apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts: The push providers list (lines 44–52) is missing both Pushwoosh and AppIO, causing these providers to be excluded from UI sorting logic.

Add Pushwoosh = 'pushwoosh' to the framework enum and both PushProviderIdEnum.Pushwoosh and PushProviderIdEnum.AppIO to the UI sort array.

🤖 Fix all issues with AI agents
In @packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts:
- Around line 24-35: The sendMessage method currently returns a stubbed success
and must not do that; either implement real Pushwoosh API calls using
this.config.applicationCode and this.config.apiKey (follow Pushwoosh docs for
/createMessage and handle response ids/date and errors) or change sendMessage to
immediately throw a descriptive error (e.g., "Pushwoosh provider not
implemented") so callers cannot record false successes; update the function
sendMessage in the Pushwoosh provider to perform the chosen action and ensure
error handling returns or throws on non-200 responses.
- Around line 10-23: Constructor in PushwooshPushProvider uses applicationCode
which mismatches the credentials schema key; change the constructor parameter
name from applicationCode to applicationId so it aligns with
CredentialsKeyEnum.ApplicationId and ensure all internal references in
PushwooshPushProvider use applicationId (leave apiKey as-is); do not add
readonly or alter the existing channelType type assertion here.

In @packages/shared/src/consts/providers/channels/push.ts:
- Around line 18-20: pushwooshConfig is wired with
CredentialsKeyEnum.ApplicationId (which yields 'applicationId') but the
Pushwoosh provider constructor (pushwoosh.provider.ts expecting applicationCode)
will receive undefined; update the mapping so the credentials-to-provider mapper
maps CredentialsKeyEnum.ApplicationId to the provider field name applicationCode
(or change the credential key to the correct enum that resolves to
'applicationCode') ensuring pushwooshConfig -> applicationCode is supplied to
the Pushwoosh provider constructor.

In @packages/shared/src/consts/providers/credentials/provider-credentials.ts:
- Around line 744-758: pushwooshConfig uses CredentialsKeyEnum.ApplicationId but
PushwooshPushProvider expects config.applicationCode and there is no handler
wiring credentials into the provider; add a new handler file named
pushwoosh.handler.ts in libs/application-generic/src/factories/push/handlers
that maps credentials.applicationId (or CredentialsKeyEnum.ApplicationId) to
applicationCode and passes apiKey to the provider, register this handler in the
push provider factory so the factory returns a PushwooshPushProvider instance
wired with { applicationCode, apiKey } (or adjust provider-credentials.ts to
rename the key to match applicationCode if you prefer key-name alignment instead
of mapping).
🧹 Nitpick comments (2)
packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts (1)

1-33: Harden tests: use enums/types and plan for future HTTP mocking.

  • Prefer PushProviderIdEnum.Pushwoosh / ChannelTypeEnum.PUSH over string literals.
  • Type options (or at least satisfies IPushOptions) so the test fails on API drift.
  • When sendMessage is implemented against Pushwoosh REST, mock the HTTP layer here to avoid network/flaky tests.
Proposed test tightening
+import { ChannelTypeEnum, PushProviderIdEnum } from '@novu/shared';
+import type { IPushOptions } from '../push.interface'; // adjust import to actual location
 import { PushwooshPushProvider } from './pushwoosh.provider';

 describe('PushwooshPushProvider', () => {
     const config = {
         applicationCode: 'TEST-APP-CODE',
         apiKey: 'test-api-key',
     };

     test('should create provider instance', () => {
         const provider = new PushwooshPushProvider(config);
-        expect(provider.id).toBe('pushwoosh');
-        expect(provider.channelType).toBe('push');
+        expect(provider.id).toBe(PushProviderIdEnum.Pushwoosh);
+        expect(provider.channelType).toBe(ChannelTypeEnum.PUSH);
     });

     test('should send message successfully', async () => {
         const provider = new PushwooshPushProvider(config);

-        const options = {
+        const options = {
             title: 'Test Notification',
             content: 'This is a test message',
             target: ['device-token-1', 'device-token-2'],
             payload: {
                 customData: 'test',
             },
-        };
+        } satisfies IPushOptions;

         const result = await provider.sendMessage(options);

         expect(result).toHaveProperty('ids');
         expect(result).toHaveProperty('date');
         expect(Array.isArray(result.ids)).toBe(true);
     });
 });
packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts (1)

1-9: Avoid TODO/comment blocks in committed provider code; track via issue and keep code minimal.

Per the repo’s TS guidelines, inline TODOs/comments should be avoided unless they explain something non-trivial. Once sendMessage fails fast (or is implemented), those comments can move to an issue/PR description (or a short docstring if truly necessary).

Also applies to: 24-30

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7488c61 and a83e80a.

📒 Files selected for processing (6)
  • packages/providers/src/lib/push/index.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
  • packages/shared/src/consts/providers/channels/push.ts
  • packages/shared/src/consts/providers/credentials/provider-credentials.ts
  • packages/shared/src/types/providers.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (isLoading, hasError)
Add blank lines before return statements
Import motion components from 'motion/react' instead of 'motion-react'

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication, minimize code duplication as possible
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Structure files: exported component, subcomponents, helpers, static content, types
Don't leave comments in code, unless they explain something complex and not trivial
Don't use nested ternaries
Favor named exports for components
Use TypeScript for all code; prefer interfaces over types
In front end code, use types over interfaces
Use functional components with TypeScript types
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
Add blank lines before return statements
When importing "motion-react" package, import it from "motion/react"

Files:

  • packages/shared/src/consts/providers/credentials/provider-credentials.ts
  • packages/providers/src/lib/push/index.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
  • packages/shared/src/consts/providers/channels/push.ts
  • packages/shared/src/types/providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use functional and declarative programming patterns; avoid classes

Files:

  • packages/shared/src/consts/providers/credentials/provider-credentials.ts
  • packages/providers/src/lib/push/index.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
  • packages/shared/src/consts/providers/channels/push.ts
  • packages/shared/src/types/providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (CLAUDE.md)

Favor named exports for components

Files:

  • packages/shared/src/consts/providers/credentials/provider-credentials.ts
  • packages/providers/src/lib/push/index.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
  • packages/shared/src/consts/providers/channels/push.ts
  • packages/shared/src/types/providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
**

📄 CodeRabbit inference engine (.cursor/rules/novu.mdc)

Use lowercase with dashes for directories and files (e.g., components/auth-wizard)

Files:

  • packages/shared/src/consts/providers/credentials/provider-credentials.ts
  • packages/providers/src/lib/push/index.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
  • packages/shared/src/consts/providers/channels/push.ts
  • packages/shared/src/types/providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
🧬 Code graph analysis (3)
packages/shared/src/consts/providers/credentials/provider-credentials.ts (1)
packages/shared/src/consts/providers/provider.interface.ts (1)
  • IConfigCredential (59-84)
packages/shared/src/consts/providers/channels/push.ts (1)
packages/shared/src/consts/providers/credentials/provider-credentials.ts (1)
  • pushwooshConfig (744-758)
packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts (1)
packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts (1)
  • PushwooshPushProvider (10-36)
🔇 Additional comments (1)
packages/providers/src/lib/push/index.ts (1)

8-8: Barrel export looks correct.

Assuming packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts exists, this is a clean addition.

Comment on lines +18 to 20
pushwooshConfig,
pushWebhookConfig,
} from '../credentials';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 1) Confirm the logo asset exists somewhere in-repo
echo "=== Searching for pushwoosh.svg asset ==="
rg -n --hidden -S "pushwoosh\.svg" .

# 2) Find where provider credentials are transformed
echo ""
echo "=== Searching for applicationCode references ==="
rg -n --type=ts -C2 "applicationCode" .

echo ""
echo "=== Searching for CredentialsKeyEnum.ApplicationId ==="
rg -n --type=ts -C2 "CredentialsKeyEnum\.ApplicationId" packages

Repository: novuhq/novu

Length of output: 4963


🏁 Script executed:

#!/bin/bash
# 1) Search for actual asset files - look in public/assets or similar directories
echo "=== Searching for actual .svg asset files ==="
find . -type f -name "*.svg" | grep -i pushwoosh

echo ""
echo "=== Search all directories for .svg files to see where assets are stored ==="
find . -type d -name "assets" -o -type d -name "public" | head -20

echo ""
echo "=== Look at the pushwooshConfig definition ==="
rg -n --type=ts "export const pushwooshConfig" packages/shared/src/consts/providers/credentials/ -A 20

echo ""
echo "=== Find credential transformation/mapping logic ==="
rg -n --type=ts "credentials.*config\|mapCredentials\|transformCredentials" packages/providers/src/lib/push/pushwoosh/ -A 5

Repository: novuhq/novu

Length of output: 2741


🏁 Script executed:

#!/bin/bash
# Search for credential transformation, base provider, or factory patterns
echo "=== Search for credential mapping utilities ==="
rg -n --type=ts "CredentialsKeyEnum" packages/providers/src/lib/ -B 2 -A 2 | head -50

echo ""
echo "=== Look for BaseProvider or transformation patterns ==="
rg -n --type=ts "class.*Provider|constructor.*credentials" packages/providers/src/lib/push/pushwoosh/ -A 10

echo ""
echo "=== Check if there's a credentials-to-config mapping somewhere ==="
rg -n --type=ts "camelCase|toCamelCase|mapCredentials\|ApplicationId.*applicationCode" packages/providers/src/ -B 2 -A 2 | head -60

echo ""
echo "=== Check the full pushwoosh provider implementation ==="
cat -n packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts

Repository: novuhq/novu

Length of output: 6252


🏁 Script executed:

#!/bin/bash
# Search for where PushwooshPushProvider is instantiated
echo "=== Find provider instantiation patterns ==="
rg -n --type=ts "new PushwooshPushProvider\|PushwooshPushProvider\(" packages/providers/src/ -B 5 -A 5

echo ""
echo "=== Look for factory/provider instantiation patterns ==="
rg -n --type=ts "providerFactory\|createProvider\|instantiate" packages/providers/src/lib/ -B 2 -A 5 | head -80

echo ""
echo "=== Check if BaseProvider has credential handling logic ==="
sed -n '1,150p' packages/providers/src/base.provider.ts | cat -n

Repository: novuhq/novu

Length of output: 5600


🏁 Script executed:

#!/bin/bash
# Search for credential initialization or mapping patterns
echo "=== Search for credentials hydration/mapping ==="
rg -n --type=ts "credentials.*\[CredentialsKeyEnum\|credentials\[.*ApplicationId\|config\[.*applicationCode" packages/providers/src/ -B 3 -A 3

echo ""
echo "=== Search for push provider factory or resolver ==="
rg -n --type=ts "pushwoosh\|Pushwoosh" packages/ --type=ts | grep -E "(factory|resolver|instantiate|create|hydrate)" | head -30

echo ""
echo "=== Look for index/exports in push providers to find integration point ==="
cat -n packages/providers/src/lib/push/index.ts 2>/dev/null || echo "File not found"

echo ""
echo "=== Search for any credential mapping patterns ==="
rg -n --type=ts "CredentialsKeyEnum\.(ApiKey|ApplicationId)" packages/providers/src/ -B 3 -A 3 | head -100

Repository: novuhq/novu

Length of output: 750


🏁 Script executed:

#!/bin/bash
# Search in shared package for credential handling
echo "=== Search in shared for push provider credential handling ==="
rg -n --type=ts "PushwooshPushProvider\|pushwoosh" packages/shared/src/ -B 2 -A 5

echo ""
echo "=== Search for credential resolver or factory pattern ==="
rg -n --type=ts "credentials\[.*key\]|getCredentialField|resolveCredential" packages/ --type=ts -B 2 -A 5 | head -80

echo ""
echo "=== Look at push.ts file more carefully to understand imports ==="
head -50 packages/shared/src/consts/providers/channels/push.ts

echo ""
echo "=== Check how other providers use credentials in registry ==="
rg -n --type=ts "credentials:" packages/shared/src/consts/providers/channels/ -B 1 -A 1 | head -40

Repository: novuhq/novu

Length of output: 5135


🏁 Script executed:

#!/bin/bash
# Search for CredentialsKeyEnum definition to understand enum-to-field mapping
echo "=== Find CredentialsKeyEnum definition ==="
rg -n "enum CredentialsKeyEnum|export enum CredentialsKeyEnum" packages/ -A 30 | head -80

echo ""
echo "=== Search for any credential transformation or mapping ==="
rg -n --type=ts "ApplicationId.*applicationCode\|applicationCode.*ApplicationId" packages/ -B 2 -A 2

echo ""
echo "=== Look for any Pushwoosh-specific credential handling ==="
rg -n --type=ts "pushwoosh.*cred\|credential.*pushwoosh" packages/providers/src/lib/push/pushwoosh/ -i -B 3 -A 3

Repository: novuhq/novu

Length of output: 2363


🏁 Script executed:

#!/bin/bash
# Double-check the logo asset exists and is correctly referenced
echo "=== Verify pushwoosh logo assets exist ==="
ls -la ./apps/dashboard/public/images/providers/light/square/pushwoosh.svg
ls -la ./apps/web/public/static/images/providers/light/square/pushwoosh.svg
ls -la ./apps/web/public/static/images/providers/dark/square/pushwoosh.svg

echo ""
echo "=== Confirm the provider expects applicationCode ==="
grep -n "applicationCode" packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts

Repository: novuhq/novu

Length of output: 612


Fix Pushwoosh provider credential key mismatch.

The credentials: pushwooshConfig uses CredentialsKeyEnum.ApplicationId, which maps to the field name 'applicationId'. However, the Pushwoosh provider constructor expects 'applicationCode' (line 17 of pushwoosh.provider.ts). This mismatch will cause the provider to receive undefined for the application code at runtime.

Verify that the credentials-to-provider mapper correctly transforms CredentialsKeyEnum.ApplicationId to the applicationCode field, or update the credential configuration to use the correct enum key.

🤖 Prompt for AI Agents
In @packages/shared/src/consts/providers/channels/push.ts around lines 18 - 20,
pushwooshConfig is wired with CredentialsKeyEnum.ApplicationId (which yields
'applicationId') but the Pushwoosh provider constructor (pushwoosh.provider.ts
expecting applicationCode) will receive undefined; update the mapping so the
credentials-to-provider mapper maps CredentialsKeyEnum.ApplicationId to the
provider field name applicationCode (or change the credential key to the correct
enum that resolves to 'applicationCode') ensuring pushwooshConfig ->
applicationCode is supplied to the Pushwoosh provider constructor.

Comment on lines +744 to +758
export const pushwooshConfig: IConfigCredential[] = [
{
key: CredentialsKeyEnum.ApiKey,
displayName: 'API Access Token',
type: 'text',
required: true,
},
{
key: CredentialsKeyEnum.ApplicationId,
displayName: 'Application Code',
type: 'text',
required: true,
},
...pushConfigBase,
];
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the provider-credentials.ts file to understand pushConfigBase and the full context
fd provider-credentials.ts

Repository: novuhq/novu

Length of output: 127


🏁 Script executed:

# Search for Pushwoosh provider implementation
rg -i "pushwoosh" --type ts --type tsx -l

Repository: novuhq/novu

Length of output: 82


🏁 Script executed:

# Search for how credentials are mapped/used
rg "applicationCode" --type ts --type tsx -B 2 -A 2

Repository: novuhq/novu

Length of output: 82


🏁 Script executed:

# Search for Pushwoosh without type filters
rg -i "pushwoosh" -B 2 -A 2

Repository: novuhq/novu

Length of output: 6245


🏁 Script executed:

# Look at the provider-credentials.ts file to see pushConfigBase
cat packages/shared/src/consts/providers/credentials/provider-credentials.ts | head -100

Repository: novuhq/novu

Length of output: 2146


🏁 Script executed:

# Search for where credentials are mapped or used
rg "applicationCode" -B 3 -A 3

Repository: novuhq/novu

Length of output: 2014


🏁 Script executed:

# Find Pushwoosh provider implementation
fd -i pushwoosh

Repository: novuhq/novu

Length of output: 429


🏁 Script executed:

# Find where credentials are mapped to provider config
rg "CredentialsKeyEnum" -B 2 -A 2

Repository: novuhq/novu

Length of output: 50367


🏁 Script executed:

# Look at CredentialsKeyEnum definition
fd -i credentials -type d

Repository: novuhq/novu

Length of output: 225


🏁 Script executed:

# Search for provider initialization with credentials
rg "new.*Provider.*config" -B 3 -A 3

Repository: novuhq/novu

Length of output: 21998


🏁 Script executed:

# Search for any mapping or transform from credentials to provider config
rg "applicationCode\|ApplicationId" -B 3 -A 3

Repository: novuhq/novu

Length of output: 37


🏁 Script executed:

# Search for Pushwoosh handler in factories
find libs/application-generic/src/factories -name "*pushwoosh*"

Repository: novuhq/novu

Length of output: 37


🏁 Script executed:

# List all push handlers
ls -la libs/application-generic/src/factories/push/handlers/

Repository: novuhq/novu

Length of output: 834


🏁 Script executed:

# Search for buildProvider or push handlers that might map credentials
rg "buildProvider" libs/application-generic/src/factories/push/ -A 8 | head -100

Repository: novuhq/novu

Length of output: 8504


🏁 Script executed:

# Check if Pushwoosh is registered in the push.factory.ts
cat libs/application-generic/src/factories/push/push.factory.ts

Repository: novuhq/novu

Length of output: 1013


🏁 Script executed:

# Check the index.ts file to see what handlers are exported
cat libs/application-generic/src/factories/push/handlers/index.ts

Repository: novuhq/novu

Length of output: 335


🏁 Script executed:

# Check the Pushwoosh provider test to confirm it expects applicationCode
cat packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts

Repository: novuhq/novu

Length of output: 1078


🏁 Script executed:

# Verify the provider class to see the exact config property names
cat packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts

Repository: novuhq/novu

Length of output: 1112


Missing Pushwoosh integration handler and breaking credential key mismatch.

The Pushwoosh provider integration is incomplete: no handler exists in the factory system, and there's a property name mismatch between credentials and provider expectations. The pushwooshConfig defines the "Application Code" credential as CredentialsKeyEnum.ApplicationId, but the PushwooshPushProvider constructor expects config.applicationCode. Without a handler to map credentials to the provider config, this integration cannot function.

Create libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts with explicit mapping from credentials.applicationId to applicationCode, register it in the factory, and update provider-credentials.ts to use a credential key that matches the provider's expected property name (or add the mapping layer).

🤖 Prompt for AI Agents
In @packages/shared/src/consts/providers/credentials/provider-credentials.ts
around lines 744 - 758, pushwooshConfig uses CredentialsKeyEnum.ApplicationId
but PushwooshPushProvider expects config.applicationCode and there is no handler
wiring credentials into the provider; add a new handler file named
pushwoosh.handler.ts in libs/application-generic/src/factories/push/handlers
that maps credentials.applicationId (or CredentialsKeyEnum.ApplicationId) to
applicationCode and passes apiKey to the provider, register this handler in the
push provider factory so the factory returns a PushwooshPushProvider instance
wired with { applicationCode, apiKey } (or adjust provider-credentials.ts to
rename the key to match applicationCode if you prefer key-name alignment instead
of mapping).

…ider

- Change applicationCode to applicationId in provider constructor
- Replace stub sendMessage response with throw Error
- Create pushwoosh.handler.ts for credential mapping
- Register PushwooshHandler in push factory
- Add Pushwoosh to PushProviderIdEnum in framework/shared.ts
- Add Pushwoosh and AppIO to UI sort-providers list
- Update tests to use enums and expect error throw
Copy link
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: 0

🧹 Nitpick comments (3)
packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts (2)

12-12: Remove redundant type assertion.

The type assertion as ChannelTypeEnum.PUSH is unnecessary since you're assigning ChannelTypeEnum.PUSH to a property that will already have that type.

♻️ Simplify the type declaration
-    channelType = ChannelTypeEnum.PUSH as ChannelTypeEnum.PUSH;
+    channelType = ChannelTypeEnum.PUSH;

24-30: Improve unused parameter handling.

While the not-implemented state is expected per PR objectives, the void options; statement is a non-idiomatic way to suppress TypeScript's unused parameter warning.

♻️ Use underscore prefix for intentionally unused parameters
     async sendMessage(
-        options: IPushOptions
+        _options: IPushOptions
     ): Promise<ISendMessageSuccessResponse> {
-        void options;
-
         throw new Error('PushwooshPushProvider.sendMessage is not implemented yet');
     }

This pattern explicitly signals that the parameter is intentionally unused, which is clearer than the void statement.

libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts (1)

10-19: Consider making the error message more descriptive.

The validation logic is correct, but the error message could be more helpful by specifying which credentials are missing.

💡 Suggested improvement for error clarity
 buildProvider(credentials: ICredentials) {
     if (!credentials.apiKey || !credentials.applicationId) {
-        throw Error('Config is not valid for Pushwoosh');
+        throw Error('Missing required Pushwoosh credentials: apiKey and applicationId');
     }

     this.provider = new PushwooshPushProvider({
         applicationId: credentials.applicationId,
         apiKey: credentials.apiKey,
     });
 }
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a83e80a and 0efd55f.

📒 Files selected for processing (7)
  • apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts
  • libs/application-generic/src/factories/push/handlers/index.ts
  • libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts
  • libs/application-generic/src/factories/push/push.factory.ts
  • packages/framework/src/shared.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.spec.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (isLoading, hasError)
Add blank lines before return statements
Import motion components from 'motion/react' instead of 'motion-react'

**/*.{ts,tsx}: Write concise, technical TypeScript code with accurate examples
Use functional and declarative programming patterns; avoid classes
Prefer iteration and modularization over code duplication, minimize code duplication as possible
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
Structure files: exported component, subcomponents, helpers, static content, types
Don't leave comments in code, unless they explain something complex and not trivial
Don't use nested ternaries
Favor named exports for components
Use TypeScript for all code; prefer interfaces over types
In front end code, use types over interfaces
Use functional components with TypeScript types
Use the "function" keyword for pure functions
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
Add blank lines before return statements
When importing "motion-react" package, import it from "motion/react"

Files:

  • libs/application-generic/src/factories/push/push.factory.ts
  • libs/application-generic/src/factories/push/handlers/index.ts
  • libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts
  • packages/framework/src/shared.ts
  • apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use functional and declarative programming patterns; avoid classes

Files:

  • libs/application-generic/src/factories/push/push.factory.ts
  • libs/application-generic/src/factories/push/handlers/index.ts
  • libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts
  • packages/framework/src/shared.ts
  • apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (CLAUDE.md)

Favor named exports for components

Files:

  • libs/application-generic/src/factories/push/push.factory.ts
  • libs/application-generic/src/factories/push/handlers/index.ts
  • libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts
  • packages/framework/src/shared.ts
  • apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
**

📄 CodeRabbit inference engine (.cursor/rules/novu.mdc)

Use lowercase with dashes for directories and files (e.g., components/auth-wizard)

Files:

  • libs/application-generic/src/factories/push/push.factory.ts
  • libs/application-generic/src/factories/push/handlers/index.ts
  • libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts
  • packages/framework/src/shared.ts
  • apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts
  • packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts
apps/{dashboard,web}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Prefer types over interfaces in frontend code

Files:

  • apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts
🧬 Code graph analysis (3)
libs/application-generic/src/factories/push/push.factory.ts (1)
libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts (1)
  • PushwooshHandler (5-20)
libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts (2)
packages/shared/src/entities/integration/credential.interface.ts (1)
  • ICredentials (1-56)
packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts (1)
  • PushwooshPushProvider (10-31)
packages/framework/src/shared.ts (1)
packages/shared/src/types/events.ts (1)
  • IAttachmentOptions (14-21)
🔇 Additional comments (7)
packages/framework/src/shared.ts (1)

189-189: LGTM! Pushwoosh enum addition follows established pattern.

The new enum member follows the same lowercase naming convention as other push providers and integrates cleanly with the existing PushProviderIdEnum.

libs/application-generic/src/factories/push/push.factory.ts (1)

11-11: LGTM! PushwooshHandler registration follows the factory pattern.

The handler import and instantiation are consistent with existing push providers. The factory's getHandler method will automatically discover the new handler through the existing array iteration logic.

Also applies to: 25-25

apps/web/src/pages/integrations/components/multi-provider/sort-providers.ts (1)

52-53: LGTM! Provider ordering additions are correct.

AppIO and Pushwoosh have been added to the PUSH channel ordering array, which will properly position them in the integrations UI. The placement at the end of the list is appropriate for newly added providers.

libs/application-generic/src/factories/push/handlers/index.ts (1)

9-9: LGTM! Export addition completes the handler integration.

The pushwoosh.handler export follows the established barrel export pattern and makes the PushwooshHandler accessible to the push factory.

packages/providers/src/lib/push/pushwoosh/pushwoosh.provider.ts (1)

15-22: LGTM! Constructor follows the provider pattern.

The constructor correctly accepts and stores the configuration. Credential validation is appropriately handled at the handler level (PushwooshHandler.buildProvider), consistent with the established provider architecture.

libs/application-generic/src/factories/push/handlers/pushwoosh.handler.ts (2)

1-3: LGTM!

The imports are clean, properly organized, and all are utilized in the code.


5-8: LGTM!

The constructor properly initializes the handler with the correct provider ID and channel type, following the established handler pattern.

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.

🚀 Feature: Building up Pushwoosh

1 participant