awesome-mailchimp-v3-api-js
v1.0.6
Published
A simple and awesome library for Mailchimp API V3 written in Js
Downloads
13
Readme
awesome-mailchimp-v3-api-js
A simple library for mailchimp API V3 written in Js
Usage
This can be installed via npm using:
$ npm install awesome-mailchimp-v3-api-js
Then require the module in your code:
const Mailchimp = require('awesome-mailchimp-v3-api-js');
// or ES6 import
import Mailchimp from 'awesome-mailchimp-v3-api-js';
API Examples
Create a list
const mailChimp = new MailChimp('email','api-key');
const listData = {'name':'Library Test List',
'contact':{
'company':'Mailchimp',
'address1':'France',
'city':'Paris',
'state':'Paris',
'zip':'000',
'country':'France'
},
"permission_reminder":"You gave us permission",
"campaign_defaults":{
"from_name":",Mayowa",
"from_email":"[email protected]",
"subject":"New list created",
"language":"en"
},
"email_type_option":true
};
mailChimp.list.createList(listData).then((data)=>{
console.log(data);
}).catch((error)=>{
console.log(error);
});
Get info about a list
mailChimp.list.readListInfo('list-id',{}).then((data) => {
console.log(data);
}).catch((error) => {
console.log(error);
});
Subscribe Members to a list
mailChimp.members.addMembers('list-id',body).then((data)=>{
console.log(data);
}).catch((error)=>{
console.log(error);
})
Batch Subscribe members to a list
mailChimp.list.batchSubscribe('list-id',body).then((data) =>{
console.log(data);
}).catch((error)=>{
console.log(error);
});
Update Member info
mailChimp.members.updateMemberInfo('list-id', 'subscriber-hash',body).then((data)=>{
console.log(data);
}).catch((error)=>{
console.log(error);
})
Delete Member
mailChimp.members.deleteMember('list-id', 'subscriber-hash').then((data)=>{
console.log(data);
}).catch((error)=>{
console.log(error);
})
---Check for more examples in the test folder. ---