npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rocketchat-node

v0.1.4

Published

Rocket chat node api

Downloads

5

Readme

JavaScript RocketChat API for node.js

Devrelease of next version of RocketChat. Do not rely on this package

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:

$ npm install rocketchat

or

Install via git clone:

$ git clone https://github.com/qeesung/rocketchat-node.git
$ cd rocketchat-node
$ npm install

Examples

Create the rocket-chat client

var RocketChatApi = require('rocketchat').RocketChatApi;
// alpha-api versions
var rocketChatApi = new RocketChatApi('http', config.host, config.port, config.user, config.password);
// v1-api versions
var rocketChatApi = new RocketChatApi('http', config.host, config.port, config.user, config.password, "v1");

Obtaining the running rocket-chat version

rocketChatApi.version(function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Login rocket-chat

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.

Logoff rocket-chat

rocketChatApi.logout(function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Get list of public rooms

rocketChatApi.getPublicRooms(function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Join a room

rocketChatApi.joinRoom(roomID ,function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Leave a room

rocketChatApi.leaveRoom(roomID ,function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Create a room

rocketChatApi.createRoom(roomName ,function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Set a rooms topic

rocketChatApi.setTopic(roomID, topicName, function(err, body){
    if(err)
         console.log(err);
    else
        console.log(body);
})

Get all unread messages in a room

rocketChatApi.getUnreadMsg(roomID ,function(err,body){
	if(err)
		console.log(err);
	else
		console.log(body);
})

Sending a message

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

Options

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

Implemented APIs

  • 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
  • Set Topic for Room

TODO

  • achieved OAuth authentication mode
  • Add SSL security mode