RocketChat/rocketchat-node

Name: rocketchat-node

Owner: Rocket.Chat

Description: rocket-chat node api

Forked from: qeesung/rocketchat-node

Created: 2016-12-27 03:11:09.0

Updated: 2016-12-27 03:11:11.0

Pushed: 2016-11-18 06:49:09.0

Homepage: null

Size: 19

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

JavaScript RocketChat API for node.js

A node.js module, which provides an object oriented wrapper for the RocketChat REST API.

RocketChat official website address can be found here . RocketChat REST API document can be found here.

This Lib library package the following functions:

Installation

Install with the node package manager npm:

m install rocketchat

or

Install via git clone:

t clone https://github.com/qeesung/rocketchat-node.git
 rocketchat-node
m install
Examples
Create the rocket-chat client
RocketChatApi = require('rocketchat').RocketChatApi;
rocketChatApi = new RocketChatApi('http', config.host, config.port, config.user, config.password);
Obtaining the running rocket-chat version
etChatApi.version(function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Login rocket-chat
etChatApi.login(function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

You don't have to log in every time, and automatically log on when you call the other interface.

Logoff rocket-chat
etChatApi.logout(function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Get list of public rooms
etChatApi.getPublicRooms(function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Join a room
etChatApi.joinRoom(roomID ,function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Leave a room
etChatApi.getUnreadMsg(roomID ,function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Create a room
etChatApi.createRoom(roomName ,function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Get all unread messages in a room
etChatApi.leaveRoom(roomID ,function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

Sending a message
etChatApi.sendMsg(roomID, message, function(err,body){
if(err)
    console.log(err);
else
    console.log(body);

More information can be found by checking RocektChat REST API

Options

RocketChatApi Options:

Implemented APIs
TODO

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.