-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat: Add Push Webhook provider #3266
Merged
p-fernandez
merged 19 commits into
novuhq:next
from
TNAJanssen:feature/webhook-push-provider
May 4, 2023
Merged
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
85ca51b
feat(push-webhook): Adding Push webhook integration
TNAJanssen 97aae52
feat(push-webhook): Adding Push webhook integration
TNAJanssen 0eb5fd5
feat(push-webhook): Adding Push webhook integration
TNAJanssen b3cd620
feat(push-webhook): Adding Push webhook integration
TNAJanssen 148cafa
feat(push-webhook): Adding Push webhook logo
TNAJanssen 5d7ede4
feat(push-webhook): Adding tests
TNAJanssen 57eb992
Merge branch 'next' into feature/webhook-push-provider
TNAJanssen 11c2946
Merge remote-tracking branch 'origin/next' into feature/webhook-push-…
TNAJanssen 9ff1102
Update providers/push-webhook/package.json
TNAJanssen c738678
feat(push-webhook): Make changes suggested with pull request
TNAJanssen 98416f7
Update packages/application-generic/src/factories/push/handlers/push-…
TNAJanssen 291626e
Merge branch 'next' into feature/webhook-push-provider
27d61f4
Update libs/shared/src/dto/integration/construct-integration.interfac…
09b85ca
Update providers/push-webhook/package.json
TNAJanssen 4432380
Merge branch 'next' into feature/webhook-push-provider
TNAJanssen b2ee47b
Merge branch 'next' into feature/webhook-push-provider
TNAJanssen 5f9bf24
Merge branch 'next' into feature/webhook-push-provider
05d75b0
Update libs/shared/src/consts/providers/credentials/provider-credenti…
e57e262
Update libs/shared/src/consts/providers/credentials/provider-credenti…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
apps/web/public/static/images/providers/dark/push-webhook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions
45
apps/web/public/static/images/providers/light/push-webhook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/application-generic/src/factories/push/handlers/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './apns.handler'; | ||
export * from './expo.handler'; | ||
export * from './push-webhook.handler'; | ||
export * from './fcm.handler'; |
21 changes: 21 additions & 0 deletions
21
packages/application-generic/src/factories/push/handlers/push-webhook.handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ChannelTypeEnum } from '@novu/shared'; | ||
import { PushWebhookPushProvider } from '@novu/push-webhook'; | ||
import { BasePushHandler } from './base.handler'; | ||
import { ICredentials } from '@novu/dal'; | ||
|
||
export class PushWebhookHandler extends BasePushHandler { | ||
constructor() { | ||
super('push-webhook', ChannelTypeEnum.PUSH); | ||
} | ||
|
||
buildProvider(credentials: ICredentials) { | ||
if (!credentials.webhookUrl || !credentials.secretKey) { | ||
throw Error('Config is not valid for push-webhook provider'); | ||
} | ||
|
||
this.provider = new PushWebhookPushProvider({ | ||
webhookUrl: credentials.webhookUrl, | ||
hmacSecretKey: credentials.secretKey, | ||
}); | ||
} | ||
} |
8 changes: 7 additions & 1 deletion
8
packages/application-generic/src/factories/push/push.factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"path": "cz-conventional-changelog" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "../../.eslintrc.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.idea/* | ||
.nyc_output | ||
build | ||
node_modules | ||
test | ||
src/**.js | ||
coverage | ||
*.log | ||
package-lock.json |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find
baseUrl
could be a bit confusing. And as it is a specific credential property added for this feature what do you think of naming itpushWebhookUrl
? I was going to suggestwebhookUrl
in case we wanted in the future something similar with the other channels, but not sure if that's a direction we will want to take.@scopsy your thoughts about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i used the same as the other webhook proposal. I can change it to whatever you prefer :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p-fernandez iirc, I think it was listed as a credential property somewhere but not totally implemented. (this is why i used this property naming but could rename it to whatever you want btw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to the already existing webhookUrl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I realised that
baseUrl
is used for other purposes for the providers (for example when the provider needs to set a certain URL depending on the account / API key). So I think this change is a good one. 👍🏻