New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-customerio

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-customerio

NodeJS wrapper around the Customer.io REST API. Promise-style

latest
Source
npmnpm
Version
0.0.5
Version published
Weekly downloads
191
-43.32%
Maintainers
1
Weekly downloads
 
Created
Source

#Customer.io Node Client

Clean and simple NodeJS wrapper for the Customer.io REST API. Designed specifically to be as similar as possible to the main Customer.io JavaScript client.

##Installation

npm install node-customerio --save

##Example

var customer = require('node-customerio');

// Configure the module to your account
customer.init('your_site_id', 'your_api_key');

// Identify a user 
customer.identify({
  id: '123',
  email: 'billy@jean.com',
  created_at: new Date(2014, 09, 24) // can also pass UNIX timestamp here
});

// Delete a user
customer.delete('123');

// Track an event for a user
customer.track('123', 'boughtPingPongPaddle', {
  color: 'red'
});

##Methods

###customer.init(siteId, apiKey)

Set up the the module to work with your account by inputting your siteId and apiKey.

customer.init('your_site_id', 'your_api_key');

###customer.identify(properties)

Create/update a user in Customer.io, passing any properties.

Note: JavaScript dates are automatically converted to UNIX to comply with Customer.io's standard of timestamp policy.

Returns a When-style promise.

customer.identify({
  id: '123',
  email: 'chris@test.com',
  created_at: new Date(2014, 09, 24), // can also pass UNIX timestamp here
  steven: 'smith'
}).done(function (result) {
  console.log('done');
}, function (err) {
  console.log('oh noes!', err);
});

###customer.remove(customerId)

Removes a customer by id.

Returns a When-style promise.

customer.remove('547243166e8e449111f866bb').done(function () {
  console.log('done');
}, function (err) {
  console.log(err);
});

###customer.track(customerId, eventName, properties)

Track an event for a given customer. properties are optional.

Note: JavaScript dates are automatically converted to UNIX to comply with Customer.io's standard of timestamp policy.

Returns a When-style promise.

customer.track('123', 'boughtPingPongPaddle', { color: "red" }).done(function () {
  console.log('done');
}, function (err) {
  console.log('oh no', err);
});

##Why was this library built?

There is a recommended library which throws errors. Throwing errors is bad. Plus, When.js promises are the shizz for handling async flow.

Oh, and Customer.io is awesome, obviously!

##Licence

Released under the MIT license. See file called LICENCE for more details.

Keywords

customer.io

FAQs

Package last updated on 13 Sep 2015

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