/node-channelio

Node.js module for using the Channel API

Primary LanguageJavaScriptMIT LicenseMIT

node-channelio

version download status status Standard - JavaScript Style Guide

Node.js module for using the Channel API (https://developers.channel.io/docs/what-is-open-api)

Usage

Require channelio

const ChannelIO = require('node-channelio')
const client = new ChannelIO('accessKey', 'accessSecret')

Users

client.users.get('user_id', (err, data) => {
  // ...
  const userId = data.user.id
  // ...
}

client.users.update('user_id', { profile: profile } (err, data) => {
  // ...
}

client.users.delete('user_id', (err) => {
  // ...
})

Events

client.users.events.create(userId, 'Purchase', {
  name: 'Product Name',
  // ...
}, (err, data) => {
  // ...
  const eventId = data.event.id
})

client.users.events.get(userId, {
  limit: 10,
  sortOrder: 'desc'
}, (err, data) => {
// ...
  const events = data.events
})

client.users.events.delete(userId, eventId, (err) => {
// ...
})

Licence

MIT