npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-mailchimp-export

v0.4.0

Published

Mailchimp api wrapper for the mailchimp export API v1

Downloads

4

Readme

Mailchimp Export API for NodeJS(4.0+)

Greenkeeper badge npm version Build Status Maintainability codecov dependency status devDependency status Known Vulnerabilities

NPM

Mailchimp api wrapper for the mailchimp export API v1 using request/request library.

Breaking change

  • On V4+, functionName+"raw" is removed. raw is now an option.
// Easily migrate 

// FROM 
mailchimpExport.listMembersRaw({ /* params */ });
// TO
mailchimpExport.listMembers({ raw: true /* other params */ });

Install

npm install node-mailchimp-export --save

Available functions

name | description --- | --- listMembers | Export list members in a single JSON campaignSubscriberActivity | Get subscribers w/activity in a JSON array

Usage

const MailchimpExport = require('node-mailchimp-export');
const fs = require('fs');
const mailchimpExport = new MailchimpExport(YOUR_MAILCHIMP_API_KEY);

/* Export list members in a single JSON */
mailchimpExport
  .listMembers({
    // required - the list id to get members from
    id: "ListID",
    // optional – the status to get members for - one of (subscribed, unsubscribed, cleaned), defaults to subscribed
    status: "subscribed|unsubscribed|cleaned",
    // optional – pull only a certain Segment of your list.
    segment: "SEGMENT",
    // optional – only return member whose data has changed since a GMT timestamp – in YYYY-MM-DD HH:mm:ss format
    since: "YYYY-MM-DD HH:mm:ss",
    // optional – if, instead of full list data, you’d prefer a hashed list of email addresses, set this to the hashing algorithm you expect. Currently only “sha256” is supported.
    hashed: "hash",
    // optional - return a request/request object w/o any parsing. be careful when using, since it does not return a promise but a request/request object. default: false
    raw: false
  })
  .then((listMembers) => {
    // Do something with list members. NOTE: don't use then/catch when option:raw is true
  })
  .catch(console.error);

/* Export campaignSubscriberActivity - Get a single JSON Object */
mailchimpExport
  .campaignSubscriberActivity({
    // required - the campaign id to get subscriber activity from
    id: "CampaignID",
    // optional – if set to “true” a record for every email address sent to will be returned even if there is no activity data. defaults to “false”
    include_empty: "true|false",
    // optional – only return member whose data has changed since a GMT timestamp – in YYYY-MM-DD HH:mm:ss format
    since: "YYYY-MM-DD HH:mm:ss",
    // optional - return a request/request object w/o any parsing. default: false
    raw: false
  })
  .then((subscriberList) => {
    // Do something with subscriber list. NOTE: don't use then/catch when option:raw is true
  });

Example usage wih option: raw

  /* Export campaignSubscriberActivity - Get a request/request object w/ option [raw=true] */
  mailchimpExport
    .campaignSubscriberActivity({
      // required - the campaign id to get subscriber activity from
      id: "CampaignID",
      // optional – if set to “true” a record for every email address sent to will be returned even if there is no activity data. defaults to “false”
      include_empty: "true|false",
      // optional – only return member whose data has changed since a GMT timestamp – in YYYY-MM-DD HH:mm:ss format
      since: "YYYY-MM-DD HH:mm:ss",
      // optional - return a request/request object w/o any parsing. be careful when using, since it does not return a promise but a request/request object. defaults to “false”
      raw: true
    })
    .pipe(fs.createWriteStream('yourRawCampaignSubscriberActivities.txt'));

For more info on other ways to pipe the data, check this

For an updated list of params, check the API Docs here