-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(providers): Add Pushwoosh push notification provider #9813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { PushwooshPushProvider } from '@novu/providers'; | ||
| import { ChannelTypeEnum, ICredentials, PushProviderIdEnum } from '@novu/shared'; | ||
| import { BasePushHandler } from './base.handler'; | ||
|
|
||
| export class PushwooshHandler extends BasePushHandler { | ||
| constructor() { | ||
| super(PushProviderIdEnum.Pushwoosh, ChannelTypeEnum.PUSH); | ||
| } | ||
|
|
||
| buildProvider(credentials: ICredentials) { | ||
| if (!credentials.apiKey || !credentials.applicationId) { | ||
| throw Error('Config is not valid for Pushwoosh'); | ||
| } | ||
|
|
||
| this.provider = new PushwooshPushProvider({ | ||
| applicationId: credentials.applicationId, | ||
| apiKey: credentials.apiKey, | ||
| }); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { ChannelTypeEnum, PushProviderIdEnum } from '@novu/shared'; | ||
| import { PushwooshPushProvider } from './pushwoosh.provider'; | ||
|
|
||
| describe('PushwooshPushProvider', () => { | ||
| const config = { | ||
| applicationId: 'TEST-APP-CODE', | ||
| apiKey: 'test-api-key', | ||
| }; | ||
|
|
||
| test('should create provider instance', () => { | ||
| const provider = new PushwooshPushProvider(config); | ||
| expect(provider.id).toBe(PushProviderIdEnum.Pushwoosh); | ||
| expect(provider.channelType).toBe(ChannelTypeEnum.PUSH); | ||
| }); | ||
|
|
||
| test('should throw not implemented error', async () => { | ||
| const provider = new PushwooshPushProvider(config); | ||
|
|
||
| const options = { | ||
| title: 'Test Notification', | ||
| content: 'This is a test message', | ||
| target: ['device-token-1', 'device-token-2'], | ||
| payload: { | ||
| customData: 'test', | ||
| }, | ||
| }; | ||
|
|
||
| await expect(provider.sendMessage(options)).rejects.toThrow( | ||
| 'PushwooshPushProvider.sendMessage is not implemented yet' | ||
| ); | ||
| }); | ||
| }); | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { | ||
| ChannelTypeEnum, | ||
| IPushOptions, | ||
| IPushProvider, | ||
| ISendMessageSuccessResponse, | ||
| } from '@novu/stateless'; | ||
| import { PushProviderIdEnum } from '@novu/shared'; | ||
| import { BaseProvider, CasingEnum } from '../../../base.provider'; | ||
|
|
||
| export class PushwooshPushProvider extends BaseProvider implements IPushProvider { | ||
| id = PushProviderIdEnum.Pushwoosh; | ||
| channelType = ChannelTypeEnum.PUSH as ChannelTypeEnum.PUSH; | ||
| protected casing: CasingEnum = CasingEnum.CAMEL_CASE; | ||
|
|
||
| constructor( | ||
| private config: { | ||
| applicationId: string; | ||
| apiKey: string; | ||
| } | ||
| ) { | ||
| super(); | ||
| } | ||
|
|
||
| async sendMessage( | ||
| options: IPushOptions | ||
| ): Promise<ISendMessageSuccessResponse> { | ||
| void options; | ||
|
|
||
| throw new Error('PushwooshPushProvider.sendMessage is not implemented yet'); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ import { | |
| oneSignalConfig, | ||
| pusherBeamsConfig, | ||
| pushpadConfig, | ||
| pushwooshConfig, | ||
| pushWebhookConfig, | ||
| } from '../credentials'; | ||
|
Comment on lines
+18
to
20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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" packagesRepository: 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 5Repository: 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.tsRepository: 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 -nRepository: 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 -100Repository: 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 -40Repository: 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 3Repository: 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.tsRepository: novuhq/novu Length of output: 612 Fix Pushwoosh provider credential key mismatch. The Verify that the credentials-to-provider mapper correctly transforms 🤖 Prompt for AI Agents |
||
| import { IProviderConfig } from '../provider.interface'; | ||
|
|
@@ -37,6 +38,14 @@ export const pushProviders: IProviderConfig[] = [ | |
| docReference: `https://docs.novu.co/platform/integrations/push/pushpad${UTM_CAMPAIGN_QUERY_PARAM}`, | ||
| logoFileName: { light: 'pushpad.svg', dark: 'pushpad.svg' }, | ||
| }, | ||
| { | ||
| id: PushProviderIdEnum.Pushwoosh, | ||
| displayName: 'Pushwoosh', | ||
| channel: ChannelTypeEnum.PUSH, | ||
| credentials: pushwooshConfig, | ||
| docReference: `https://docs.novu.co/platform/integrations/push/pushwoosh${UTM_CAMPAIGN_QUERY_PARAM}`, | ||
| logoFileName: { light: 'pushwoosh.svg', dark: 'pushwoosh.svg' }, | ||
| }, | ||
| { | ||
| id: PushProviderIdEnum.FCM, | ||
| displayName: 'Firebase Cloud Messaging', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -741,6 +741,22 @@ export const pushpadConfig: IConfigCredential[] = [ | |
| ...pushConfigBase, | ||
| ]; | ||
|
|
||
| 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, | ||
| ]; | ||
|
Comment on lines
+744
to
+758
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's look at the provider-credentials.ts file to understand pushConfigBase and the full context
fd provider-credentials.tsRepository: novuhq/novu Length of output: 127 🏁 Script executed: # Search for Pushwoosh provider implementation
rg -i "pushwoosh" --type ts --type tsx -lRepository: novuhq/novu Length of output: 82 🏁 Script executed: # Search for how credentials are mapped/used
rg "applicationCode" --type ts --type tsx -B 2 -A 2Repository: novuhq/novu Length of output: 82 🏁 Script executed: # Search for Pushwoosh without type filters
rg -i "pushwoosh" -B 2 -A 2Repository: 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 -100Repository: novuhq/novu Length of output: 2146 🏁 Script executed: # Search for where credentials are mapped or used
rg "applicationCode" -B 3 -A 3Repository: novuhq/novu Length of output: 2014 🏁 Script executed: # Find Pushwoosh provider implementation
fd -i pushwooshRepository: novuhq/novu Length of output: 429 🏁 Script executed: # Find where credentials are mapped to provider config
rg "CredentialsKeyEnum" -B 2 -A 2Repository: novuhq/novu Length of output: 50367 🏁 Script executed: # Look at CredentialsKeyEnum definition
fd -i credentials -type dRepository: novuhq/novu Length of output: 225 🏁 Script executed: # Search for provider initialization with credentials
rg "new.*Provider.*config" -B 3 -A 3Repository: 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 3Repository: 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 -100Repository: 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.tsRepository: 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.tsRepository: 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.tsRepository: 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.tsRepository: 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 Create 🤖 Prompt for AI Agents |
||
|
|
||
| export const apnsConfig: IConfigCredential[] = [ | ||
| { | ||
| key: CredentialsKeyEnum.SecretKey, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.