0.2.0 • Published 6 years ago

simple-cw-node v0.2.0

Weekly downloads
24
License
MIT
Repository
github
Last release
6 years ago

simple-cw-node

A simple ChatWork API client for Node.js. ( UNOFFICIAL )

Installation

$ npm install simple-cw-node

Dependencies

API Document

Official API Document

RAML

Usage

The minimal you'll need to have is:

var CW = require('simple-cw-node'),
    client = CW();

// initialize.
client.init({
    token: 'YOUR_LEGACY_TOKEN'
});

// in the case of OAuth
client.init({
    type: 'oauth',
    token: 'YOUR_OAUTH_TOKEN',
})

// get your info.
client.get('me', function (err, res) {
    console.log(res.body);
});

// create room.
client.post('rooms', {
    name: 'room',
    members_admin_ids: '123456789,987654321',
    description: 'description'
}, function (err, res) {
    console.log('created.');
});

Deferred support

var CW = require('simple-cw-node'),
    client = CW(),
    Deferred = client.Deferred;

// initialize.
client.init({ token: 'YOUR_TOKEN' });

// get your info.
client
    .get('me')
    .done(function (res) {
        console.log(res.body)
    })
    .fail(function (err) {
        console.error(err);
    });

Author