Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mailchimp-api-v3

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailchimp-api-v3

Mailchimp wrapper for v3 of the mailchimp api, with transparant handling of batch operations

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.4K
decreased by-41.41%
Maintainers
1
Weekly downloads
 
Created
Source

node-mailchimp

Mailchimp api wrapper for v3 of the mailchimp api, with batch handling

var Mailchimp = require('mailchimp-api-v3')

var mailchimp = new Mailchimp(api_key);

mailchimp.get({
  path : '/lists/id1'
}, function (err, result) {
  ...
})

seamless batch calls, with polling and unpacking of results

mailchimp.batch([
{
  method : 'get',
  path : '/lists/id1'
},
{
  method : 'get',
  path : '/lists/id2'
}], function (err, results) {
  //results[0] same as result in previous example
})

Why

Version 3 of the mailchimp api is an excellent RESTful api. This library makes it easy to integrate mailchimp using their own api documentation.

This library also supports easy usage of the mailchimp batch operations, enabling them to be used just as the standard api calls.

Installation

$ npm install mailchimp-api-v3

Usage

For information on the possible calls, refer to the mailchimp api v3 documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/overview/

Initialization

var Mailchimp = require('mailchimp-api-v3')

var mailchimp = new Mailchimp(api_key);

Standard Calls

mailchimp.request({
  method : 'get|post|put|patch|delete',
  path : 'path for the call, see mailchimp documentation for possible calls'
  path_params : {
    //path parameters, see mailchimp documentation for each call
  }
  body : {
    //body parameters, see mailchimp documentation for each call
  },
  params : {
    //query string parameters, see mailchimp documentation for each call
  }
}, callback)

path can be given either exactly as in the mailchimp documentation ("/campaigns/{campaign_id}") and path_params specifying id values, or as a string with path parameters already substituted, and no path_params

For each request method, convenience calls exists to default to that method:

mailchimp.get({}, cb)
mailchimp.post({}, cb)
mailchimp.put({}, cb)
mailchimp.patch({}, cb)
mailchimp.delete({}, cb)

Batch Calls


var calls = [
{
  method : 'post',
  path : '/lists/id1/members'
  body : {
    email_address : '1@example.com',
    status : 'subscribed'
  }
},
{
  method : 'post',
  path : '/lists/id1/members'
  body : {
    email_address : '2@example.com',
    status : 'subscribed'
  }
}]


mailchimp.batch(calls, callback, {
  wait : true,
  interval : 2000,
  unpack : true,
})

batch takes an array of call options, exactly as used in the standard call.

  • wait whether or not to wait for the batch command to finish, defaults to true
  • interval if wait is true, the interval to poll for the status of the batch call, defaults to 2000ms
  • unpack if wait is true, whether or not to get and unpack the results of the batch operation, and return the response bodies.

Keywords

FAQs

Package last updated on 09 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc