Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

node-constantcontact

1.0.0 • Public • Published

node-constantcontact

Constant Contact v2 API client for Node.js

Install

$ npm install node-constantcontact --save

Usage

Setup

const ConstantContact = require('node-constantcontact');
 
const cc = new ConstantContact({
  apiKey: '',
  accessToken: ''
});

Get list of email campaigns

let req = cc.campaigns.find({ email: 'some.person@some-domain.com' });
 
req
  .catch((err) => {})
  .then((result) => {});

Search for existing contact

let req = cc.contacts.find({ email: 'test@example.org' });
 
req
  .catch((err) => {})
  .then((result) => {});

Add new contact

let contacts = [
  // array of contact objects - see
  // https://developer.constantcontact.com/docs/contacts-api/contacts-collection.html?method=POST
];

let req = cc.contacts.create(contacts, { action_by: 'ACTION_BY_OWNER' });

req
  .catch((err) => {})
  .then((result) => {});

Update existing contact

let req = cc.contacts.save(contact, { action_by: 'ACTION_BY_OWNER '});
 
req
  .catch((err) => {})
  .then((result) => {});

Advanced Usage

cc.client

Returns the internal instance of purest configured for Constant Contact.

let req = cc.client.get('activities').qs({ status: 'ERROR' }).request();
 
req
  .catch((err) => {})
  .then((result) => {});

cc.paginate(requestPromise, onPageLoad, onError, onEnd)

Follows the pagination links in a request to load each page sequentially.

cc.paginate(
  cc.contacts.find(),
  (page) => {},
  (err) => {},
  () => {}
);

cc.bulkWait(id, interval)

Waits for a bulk operation to complete.

Constant Contact API documentation

install

npm i node-constantcontact

Downloadsweekly downloads

63

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability