node-channelio

1.4.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i node-channelio

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

11.7 kB

Total Files

8

Last publish

Collaborators

  • egg-