Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

node-customerio

Package Overview
Dependencies
3
Maintainers
1
Versions
5
Issues
File Explorer

Advanced tools

node-customerio

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

    0.0.5latest

Version published
Maintainers
1
Yearly downloads
9,307
increased by2.94%

Weekly downloads

Readme

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: '[email protected]', 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: '[email protected]', 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

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc