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

api to add new vendor #17

Closed HarshaHegde1994 closed 6 years ago

HarshaHegde1994 commented 6 years ago

Hi, please give us an API to add new vendors for SMS and mail integration.

jnoleau commented 6 years ago

Hi,

You can add custom provider if you want, you just have to implement the send function which returns a Promise. See Custom in the documentation

example with email :

new NotifmeSdk({
  channels: {
    email: {
      providers: [{
        type: 'custom',
        id: 'my-custom-email-provider...',
        send: async (request) => {
          // Send email
          return 'id...'
        }
      }]
    }
  }
})
BDav24 commented 6 years ago

@HarshaHegde1994 I hope this answered your question. You can reopen this issue if you want more precisions.

HarshaHegde1994 commented 6 years ago

Thanks for the reply. can you be more specific for the request and what should that function hold?

BDav24 commented 6 years ago

request is one of the following types: https://github.com/notifme/notifme-sdk/blob/master/src/models/notification-request.js

And send should call your provider API: something like https://github.com/notifme/notifme-sdk/blob/master/src/providers/sms/46elks.js#L21-L42

What provider(s) do you want to use?

HarshaHegde1994 commented 6 years ago

Thanks for the help @BDav24. I'm using a local service provider for sending SMS.