Skip to content

yoctore/yocto-mailchimp

Repository files navigation

NPM

alt text Code Climate Test Coverage Issue Count Build Status

Overview

This module is a part of yocto node modules for NodeJS.

Please see our NPM repository for complete list of available tools (completed day after day).

This module provide a simple config validator tools for your node app.

Motivation

Create an easy and ready to use connector & model builder based on mongoose.

Mailchimp APi version

This module implements the v2.0 of the mailchimp API.

Available Methods

Configuration of module

var logger    = require('yocto-logger');
var mailchimp = require('yocto-mailchimp')(logger);

// Multiple Mailchimp account can be configured
mailchimp.loadConfig([
  {
    // Name of config
    name    : 'myAccount',
    // Private token
    token   : 'aaa4545521-us14',
    // Version of Mailchimp Api to use
    version : 'v2.0',
    // Configuration of mailing list that will be used
    list : [
      {
        // Name of the mailinglist into Mailchimp
        name        : 'test',
        // Id of the list
        id          : 'aaa',
        // Enable doubleOptin or not
        doubleOptin : false
      }
    ]
  }
]).then(function (value) {
  console.log('load config success')
}.bind(this)).catch(function (error) {
  console.log('load config failed');
});

subscribe

This method permit to subscribe an user to mailing list

Before use subscribe(), your module should be correctly initialized

mailchimp.subscribe({
  // The account name defined in config to use
  accountName : 'myAccount',
  // The mailing list name
  listName    : 'test',
  // The email to add
  email       : 'toataao@toto.fr'
]).then(function (value) {
  console.log('load config success')
}.bind(this)).catch(function (error) {
  console.log('load config failed');
});

About

Mailchimp utility wrapper to call mailchimp api

Resources

Stars

Watchers

Forks

Packages

No packages published