node package manager

customerio

node-customerio

A client for Customer.io

Installation

npm install --save customerio

Usage

var customerio = require('customerio')('CUSTOMERIO_KEY', 'CUSTOMERIO_SECRET')
customerio.identify({userId: 5, email: 'foo@example.com'}[, callback])
customerio.track({userId: 5, name: 'signup'}[, callback])
customerio.delete({userId: 5})

Methods

  • identify
  • track
  • delete

Using Promises

This library's methods return Promises, so it can be nicely composed with your backend calls.

For example if using bookshelf

return User.forge({
    email: req.body.email
}).save().then(function(user) {
    return customerio.identify({
        userId: user.id,
        email: user.get('email')
    })
})

Reason

I tried the official client however, it throws on any error. This gets worse, as it will throw even if you don't pass it an options object or a callback