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:
- create client
- login
- logout
- get list of public rooms
- join a room
- leave a room
- creating a room
- get all unread messages in a room
- sending a message
Install with the node package manager npm:
$ npm install rocketchat
or
Install via git clone:
$ git clone https://github.com/qeesung/rocketchat-node.git
$ cd rocketchat-node
$ npm install
var RocketChatApi = require('rocketchat').RocketChatApi;
var rocketChatApi = new RocketChatApi('http', config.host, config.port, config.user, config.password);
rocketChatApi.version(function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.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.
rocketChatApi.logout(function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.getPublicRooms(function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.joinRoom(roomID ,function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.getUnreadMsg(roomID ,function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.createRoom(roomName ,function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.leaveRoom(roomID ,function(err,body){
if(err)
console.log(err);
else
console.log(body);
})
rocketChatApi.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
RocketChatApi Options:
- protocol
<string>
: Typically 'http:' or 'https:' - host
<string>
: The hostname for your jira server - port
<int>
: The port your jira server is listening on (probably 80 or 443) - username
<string>
: The username to log in with - password
<string>
: Keep it secret, keep it safe
- Authentication
- HTTP
- OAuth(comming soon)
- Room
- get public rooms
- join a room
- leave a room
- Messages
- get unread messages from a room
- send messages to a room
- achieved OAuth authentication mode
- Add SSL security mode