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 = ; // Configure the module to your accountcustomer; // Identify a user customer; // Delete a usercustomer; // Track an event for a usercustomer;
Methods
customer.init(siteId, apiKey)
Set up the the module to work with your account by inputting your siteId
and apiKey
.
customer;
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;
customer.remove(customerId)
Removes a customer by id.
Returns a When-style promise.
customer;
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;
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.