notifme / notifme-sdk

A Node.js library to send all kinds of transactional notifications.
https://notifme.github.io/www/
MIT License
1.94k stars 149 forks source link

Adding providers externally via NPM #6

Closed batuhan closed 7 years ago

batuhan commented 7 years ago

I think if you guys provided a way to add providers via NPM, it would be great. My case for it is AWS services like SES (Simple E-mail Service) and SNS (Simple Notification Service, for SMS).

I was going to add AWS SDK but adding stuff to package.json to add providers seems not be scalable. Of course, AWS API works with HTTP calls but I for one don't have any experience with that.

If you agree, I would love to help making notfme extendable and discuss the best way to implement it.

BDav24 commented 7 years ago

Hi @batuhan, you're right adding packages for each new provider is definitely not scalable. HTTP covers all the cases but implementing a plugin system will certainly help to save time when a provider is not implemented yet.

You can propose a solution, that would be awesome.

Here are my first thoughts on the subject: I would create a static method addTransport(channel, channelType, callable) in NotifmeSdk which would add the provider in a static variable of ProviderFactory and then be used just before this switch: https://github.com/notifme/notifme-sdk/blob/78ffad5c43c4cf2db298c77e6879ca6f479b91bd/src/providers/factory.js#L78-L87 Do you see other possibilities?

Side note: SES is supported out of the box by nodemailer (https://nodemailer.com/transports/ses/), it should be very easy to support it in notifme.

OverFlow636 commented 7 years ago

Would like to see SNS added for native app push notifications. Can also assist with implementation!

BDav24 commented 7 years ago

Hi @OverFlow636, it would be really helpful! Can you do it without adding any dependency?

BDav24 commented 7 years ago

https://github.com/notifme/notifme-sdk/releases/tag/v0.7.0