gitevents / gitevents-mailchimp

Mailer plugin for gitevents
MIT License
0 stars 1 forks source link

Mailer API Plugin definition discussion #2

Open ifraixedes opened 9 years ago

ifraixedes commented 9 years ago

Please read the README and anything that you would like to discuss about the Mailer API Plugin post a commend here.

ifraixedes commented 9 years ago

Two things:

1. API proposed

I've been thinking that even though the send method should receive the receivers of the email than getting them from the mailer service internally, the same mailer should have the method (e.g. getSubscribers) to retrieve the list of subscribers to a list or even all the subscribers for all the lists.

Why two methods than having just only send and it manage all the subscribers to send based in a list id or something like that? Because we can keep independent the provider to send the emails and the provider which maintain the list, for example, in an hypothetical case one organisation use mandrill to send the emails but maintain the list of subscribers in meetup, then it can use mandrill-mailer to send the emails to the subscribers which are got through meetup-mailer.

The problem in having the 2 methods in the same providers are that we may have provider that only implement one method because one of them doesn't make sense, then the no implemented method should be null or undefined or maybe implement a function which throw an exception to get a clear message what it is going than getting a message like undefined is not a function.

Honestly, I would prefer to have a module for the sender an another for the subscribers, however I don't know if you feel that there is too much modularity.

2. Pains in providers

Without taken a look to a lot of number of email providers (I only looked mandrill and mailgun), I could identify some pains.

I couldn't find in mandrill API methods to manage subscribers' lists instead mailgun has; however mailchimp API has methods to get subscribers, e.g. export, lists/members

However mailgun doesn't have templates, and mailchimp has, however having renderers shouldn't be a problem and I think that we could implement, probably not in a very simple way, a renderer for mailchimp which retrieve the template, render and send it through any mailer and also we may implement a renderer that just return the template id and it is possible to use with a mailer that send the emails with send-template although in this case obviously they must be use together and who use them has to know, nonetheless with a simple comment in the documentation and the common sense should be enough.

We may also has a subscribers (method or module) could return just an id for a specific provider, as very similar described above, and a mailer of the same provider use it to identify the list of subscriber to send the email; it could be for example mailchimp, however I could not find in its API any method to send emails and Mandril#send doesn't a field to to that and the list of people must be provided in to property.

Please if I'm wrong in something, you have some ideas, comments or whatever, your comments are much appreciated.

ifraixedes commented 9 years ago

First version of plugin, v0.x implementation is implemented, however I have to implement the test, which I would do as soon as I get more free time to work on it.