novuhq / novu

Open-Source Notification Platform. Embeddable Notification Center, E-mail, Push and Slack Integrations.
https://novu.co
Other
34.58k stars 3.53k forks source link

Async Delivery Reports to Other Services #180

Open ChakshuGautam opened 2 years ago

ChakshuGautam commented 2 years ago

What?

Ability to send reports of delivery to an external service using a webhook.

Why?

Extensibility to other services.

How?

Currently there is no way for a provider to send delivery reports to the application. Is this currently in the pipeline?

On the downstream of what to do with success/failure of a notification, EventEmitter postSend can be used to handle sending this and can be processed further. Although I do thing that the config for managing webhooks for delivery reports can be part of the exiting application. https://github.com/notifirehq/notifire/blob/4ee74c9abe3d717410766738e7364a77df77c232/packages/core/src/lib/events/types.d.ts#L14

scopsy commented 2 years ago

Hey @ChakshuGautam thanks for opening the issue!

If I understand you correctly you want to get the provider (for example sendgrid) webhook response about if the message was delivered or not, bounced and etc?

If so, yes we definitely plan to support this on the API component we will announce soon and webhook integrations to all providers is on our roadmap very soon.

ChakshuGautam commented 2 years ago

Hey I would start forking the repository and implementing features based on our requirements keeping this as base. If there is a design doc for the features, I would love to contribute back. If there is an issue/branch that already exists where this is being contributed, I will be able to put some effort on that front. Since I have to implement this part of my day job. Thanks.

scopsy commented 2 years ago

We still don't have the design docs for that, we have a backlog of tasks to complete a bit before we can tackle this one. Would be really interested in jumping on a quick discord call? Are you on our server?

ChakshuGautam commented 2 years ago

Sure. Can we do in 2 hours?

scopsy commented 2 years ago

Sounds like a plan, send me a message on discord :)

Swahjak commented 2 years ago

Any update on this feature? @scopsy you mentioned that this would be on the road map very soon but I can't find any reference to it besides this issue. Is it still something you plan on implementing (short term)?

scopsy commented 2 years ago

Hi @Swahjak we plan to start to work on it probably in 3-4 weeks from now, as part of 0.9.0 which focus on the activity dashboard with extra debugging capabilities and webhook support.

Could you share a bit on your use case of why you need this functionality? Just to make sure we speak about the same thing as this issue is quite old :)

Swahjak commented 2 years ago

Cool! I'm mostly talky about delivery reports (i.e. https://postmarkapp.com/developer/webhooks/delivery-webhook) and bounce reports (i.e. https://postmarkapp.com/developer/webhooks/bounce-webhook) to be able to track if an e-mail was actually delivered (or bounced). In extend it would be really cool if there would also be support for open tracking.

This is all due to the fact that we sometimes have to 'deal' with clients who supposedly haven't received any e-mails. This makes it easier to debug whether it is us not being able to deliver or just a client overlooking an e-mail. Overall it just makes it easier to monitor deliverability or even benchmark (e-mail) services.

scopsy commented 2 years ago

Amazing this is exactly the usecase we had in mind when planning the next cycle with the advanced activity feed capabilities. Webhook reports are going to be part of it! Tagging @oba2311 here aswell :)

zlanich commented 1 year ago

@scopsy Before creating a new issue, I figured this would be a good place to ask about Expo Delivery Tickets/Receipts & polling for delivery status. I need to track delivery of messages across all providers at an application level, and for Expo specifically, we have to take the receipt ID from the Expo response and poll for the delivery status later.

Does the Expo Push provider support webhook (even though there isn't an equivalent Expo Push service webhook), and if so, does it contain the Ticket ID so we can poll for receipt later?

This is critical for Push, since we (developers or Novu) are responsible for discontinuing sending to FCM/APN when the user turns off their notifications on the device, for example.

Our team is evaluating Novu for all our projects and considering contributing to it. Let me know your thoughts, thank you!

scopsy commented 1 year ago

@zlanich I think we can utilize the webhook reports we have today for email and some other channels to Expo as well. Here is an example on how it works for SendGrid: https://github.com/novuhq/novu/blob/e4b0bacda27585047220fa6adb39ee0a2a91e493/providers/sendgrid/src/lib/sendgrid.provider.ts#L107

So we can basically create a mapping for the expo webhook information, and it will update the specific Job about the status of the delivery. Do you think it can satisfy your needs?

zlanich commented 1 year ago

@scopsy If I'm interpreting the source code correctly, it looks like the body.response would be the response from the call to the provider? If so, I feel like that would suffice for nearly anything, and if you look at the Expo node package, you can see the ticketChunk in the example is the response, which has an id, amongst other properties in it: https://github.com/expo/expo-server-sdk-node. So if we have access to the return value of parseEventBody, then we should be good to go.

Thank you!