Node.js module for using the Channel API (https://developers.channel.io/docs/what-is-open-api)
const ChannelIO = require('node-channelio')
const client = new ChannelIO('accessKey', 'accessSecret')
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) => {
// ...
})
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) => {
// ...
})
MIT