Loopback connector module which allow to send emails via Mailchimp.
npm install loopback-component-mailchimp --save
component-config.json
{
"loopback-component-mailchimp": {
"connector": "loopback-connector-mailgun",
"apikey": "[your api key here]",
"defaultListId": "[a default listId]",
"defaults": {
"double_optin" : true
}
}
}
Simple subscribe member. Returns a Promise
app.MailChimp.subscribe({
email : '[email protected]',
id : defaultListId,
firstName : 'A name',
lastName : 'A surname',
merge_vars : {
optin_ip : '192.168.0.1'
}
})
.then(function (res) {
console.log('Result :',res);
})
.catch(function (err) {
console.log('Error : ',err);
});
Simple unsubscribe member. Returns a Promise
app.MailChimp.unsubscribe(email)
.then(function (res) {
console.log('Result :',res);
})
.catch(function (err) {
console.log('Error : ',err);
});