novuhq / novu

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

🚀 Feature: Generic Mail-API provider #3626

Open ryshoooo opened 1 year ago

ryshoooo commented 1 year ago

🔖 Feature description

I'm proposing here a generic Mail-API provider, which upon triggering, calls a configured API endpoint and parses the notification data into the JSON body of the API request. The mapping of notification -> JSON body can be fully configured in the provider configuration.

🎤 Why is this feature needed ?

Sometimes there are mail providers, which are not available as directly supported providers and never will be. These could be custom-made mail providers in larger organizations or just by some very active developers. However, these providers usually have an API endpoint to call in order to send an email.

✌️ How do you aim to achieve this?

Create the generic Mail provider which calls an API endpoint.

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

jainpawan21 commented 1 year ago

Hi @ryshoooo In my opinion, this can be achieved either by using our Custom SMTP provider or the recently added email webhook provider (https://github.com/novuhq/novu/pull/3244)

ryshoooo commented 1 year ago

Hi @jainpawan21

So custom SMTP provider won't cut it as, in my current case, I don't have direct access to the SMTP server behind the API and I don't think I'll be able to get access to it. The preferred way to communicate with it is via an API call.

The webhook provider looks very promising and indeed this could potentially solve the issue. Is it included in the latest Novu release?

However, the (potential) problem with the webhook provider is that the JSON body of the message is not configurable and is given by the IEmailOptions interface. So if the API won't like the body of the message, I don't have a way to change it in the provider configuration :/

jainpawan21 commented 1 year ago

cc:- @scopsy / @p-fernandez