1.0.4 • Published 4 years ago

avengers-chatwork v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Avengers Chatwork

A simple ChatWork API client for Node.js

Installation

$ npm install avengers-chatwork

Dependencies

API Document

Official API Document

RAML

Usage

The minimal you'll need to have is:

var CW = require('avengers-chatwork'),
    client = CW();

// initialize.
client.init({
    token: 'YOUR_API_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.');
});

// Api function
client.me().then(function (res) {
    console.log(res.data);
}).catch(function (err) {
    console.log(err.response.data)
});

Deferred support

var CW = require('avengers-chatwork'),
    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