Push Webhooks
Hi,
I am working on setting up webhooks with Novu notification and I need some help with how the Push Webhook providers work.
From my current understanding it seems that I would need to create a webhook provider per user that would like to have webhooks on Novu, this doesn't seem to be a solution that scales very well and the documentation doesn't provide enough information on this.
I am also having trouble understanding how a workflow differentiates which webhook provider is being called. Is this done through the
x-novu-signature
?
Would it be possible to get some clarity on this please? π7 Replies
@Engineering can we get your help here today? π
Hey @GoldenCommunist
When setting up a Push Webhook with Novu, you do not need to create a separate webhook provider for each user.
Instead, you need to provide a single Webhook URL where Novu will send POST requests and a Secret Hmac Key, which is used to create an HMAC SHA256 hash included in the x-novu-signature header.
This header allows you to verify the authenticity of the request on your server to ensure it is coming from Novu.
When a workflow is set to use the Push Webhook provider, it does not differentiate between webhook providers per user. Instead, it makes use of the single Webhook URL that you have configured.
You will set device tokens, which can be any random string, as identifiers for each user when updating subscriber credentials using Novu's SDK or API.
This allows your webhook URL to handle POST requests for multiple users.
For clarity, this process includes the following key steps:
1. Add the Push Webhook provider in Novu with your Webhook URL and Secret Hmac Key.
2. Set up your server to verify requests using the x-novu-signature with the Secret Hmac Key.
3. Update subscriber credentials with device tokens using the Novu SDK or API.
The
x-novu-signature
is used to ensure that the request made to your webhook URL is indeed sent by Novu, leveraging the HMAC SHA256 encrypted signature that you can validate on your end for security purposes.
Here are some resources I believe you saw (But in case you didn't)
https://docs.novu.co/channels-and-providers/push/push-webhook#steps-to-configure
https://github.com/novuhq/novu/tree/9db557590180b97e8d76e307e94568939e68bc1b/providers/push-webhookThanks for the reply Emil,
From what I understand, each subscriber will be identified with a device token that the Novu Webhook post will provide us.
Though what if a specific subscriber has multiple webhooks set up with us for different workflows or has multiple webhooks attached on the same worflow for different projects. I am having trouble understanding how I can get this set up using the Novu Push Webhook Provider.
Just to clarify I was looking to create a webhook channel instead of a webhook provider.
Hey @GoldenCommunist adding here @Pawan Jain @Dima Grossman they might be able to share some more info about this. @GoldenCommunist can you share a bit more about this? Do you intended to work with other channels here? Or is it to get more capabilities of advanced webhooks?
We are trying to make a webhook system which will work let our users provide us webhooks which will be called when specific events in our main system happen.
We currently have a notification system set up with novu and we want to try to pair them to use webhooks as well.
The things I am having trouble with it, how do we set up multiple webhooks for a certain subscriber.
To clarify a certain user could have multiple channels attached to his subscriber id.
@Dima Grossman @Tomer Barnea @Pawan Jain I would really appreciate your help guys to get my webhook system project working. π
@GoldenCommunist, I'd let @Dima Grossman and @Pawan Jain answer here, I think they can be more helpful then I am.
@goldencommunist
Thanks for sharing your use case.
One push webhook provider can store one webhook URL. if a workflow is triggered to a subscriber and push webhook provider is active, novu will make
HTTP
POST request to that webhook url. HTTP POST request will have all relevant data like payload, subscriber details etc.
If more than one push webhook provider is active then Novu will make a POST request to all webhook URLs of those providers.
I see you are looking to select particular provider which is not supported for push channel providers
@GoldenCommunist ping