Skip to content
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

[NV-1812] Webhook Provider #2958

Closed
scopsy opened this issue Mar 7, 2023 · 6 comments · Fixed by #3244
Closed

[NV-1812] Webhook Provider #2958

scopsy opened this issue Mar 7, 2023 · 6 comments · Fixed by #3244
Assignees
Labels
Community Ticket Created by Linear-GitHub Sync Feature Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync

Comments

@scopsy
Copy link
Contributor

scopsy commented Mar 7, 2023

Why? (Context)

For companies that have legacy delivery systems, novu can trigger an API request with all the information related to the trigger to a webhook URL, the novu customer will be responsible for the actual delivery of the message.

What?

Implementing a new Webhook provider for each channel type novu has so that the content will still be managed on Novu's side, and instead of calling a provider such as SendGrid, we will perform an API call to the webhook.

Definition of Done

  • Webhook provider for each channel type we have
  • Users can specify the webhook URL when sending a message
  • Novu will attach an HMAC key with the payload so the user can verify that novu is the initiator of the call
  • Novu will retry to call the webhook in case it's down
  • A payload will be sent to the webhook to include the information about: notification, subscriber, and trigger payload.

From SyncLinear.com | NV-1812

@scopsy scopsy added Feature Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync labels Mar 7, 2023
@jlucidar
Copy link
Contributor

Quick question regarding this feature (as it is something that can interest my company) :
Would you include the rendered html or just the layout + template in the email channel webhook ?

Our usecase is to use different smtp config (as we offer our client to setup their own smtp in our app) and because we can't override the provider in Novu atm, using websocket and handling this by ourselves would be an acceptable tradeoff.

Do you need any external help on this feature request ?

@scopsy
Copy link
Contributor Author

scopsy commented Mar 30, 2023

@jlucidar I think it will make to pass the actually rendered template, wdyt? What would be the usecase to pass the actually layout and raw template? Do you want to render it on your end aswell?

@jlucidar
Copy link
Contributor

jlucidar commented Apr 4, 2023

We already have our own layout implementation at the moment, and it's not all the time statically generated.

I think having an option on the provider might be a good solution. so users can switch between rendered html or raw template.

Let me know if you want a PR for this :)

@scopsy
Copy link
Contributor Author

scopsy commented Apr 4, 2023

@jlucidar I think we can even pass them both so the user can decide in runtime, wdyt? And yes, would really appreciate a PR for this! Let me know if you want to discuss some implementation details you had in mind

@jlucidar
Copy link
Contributor

Hi @scopsy , I opened a draft PR towards this issue. (#3244)

At the moment only the webhook for the email channel is implemented.

A few choice I made, but not sure if this is the way you intended to do it :

  • I added two fields to the emailOptions object we transmit to the provider (payloadDetails and notificationDetails). not sure about the naming or if you prefer this as nested into another key. the subscriber info seems to be present in the payloadDetails, so I haven't duplicate its.

  • the encryption key for the hmac signature is setup by the user. (I firstly wanted to use the api key to encrypt it but it would have broken the isolation of providers )

  • if the webhook call fails it will retry every 30 seconds for a total of 3 retries.

LEt me know how that work for you and I can then complete the PR for the other channels as necessary (SMS, Push ?, In app ?)

@scopsy scopsy added the Community Ticket Created by Linear-GitHub Sync label Apr 23, 2023
@ali-master
Copy link

Hi there

Is there any plan to implement the SMS Webhook to implement the custom SMS providers by the companies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Ticket Created by Linear-GitHub Sync Feature Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants