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

@rocket.chat/botpress-channel-rocketchat

v0.0.14

Published

Channel connector for rocketchat

Downloads

13

Readme

botpress-channel-rocketchat

botpress-rocketchat

Official Rocket.Chat connector module for Botpress.

This module has been build to accelerate and facilitate development of Rocket.Chat bots.

This module is tested and working using version 10.34.0 of botpress.

Installation

  • Create a new botpress bot:
botpress init 
  • Install your bot dependencies:
npm install
  • Install this module:
npm install botpress-channel-rocketchat
  • Update the file config/channel-rocketchat.json with your bot data:
{
    "ROCKETCHAT_USER": "botpress",
    "ROCKETCHAT_PASSWORD": "botpress",
    "ROCKETCHAT_URL": "http://localhost:3001",
    "ROCKETCHAT_USE_SSL": "false",
    "ROCKETCHAT_ROOM": "GENERAL",
    "scope": ""
}
  • Start your bot.
botpress start

Get started

To setup connexion of your chatbot to Rocket.Chat follow this steps:

  • Follow the Rocket.Chat Deployment documentation:

Deployment

  • If you are in a development environment up a docker instance of Rocket.Chat, see how to make it in our example repository:

botpress-kick-starter

  • Login with your user;

  • Create a new user for your bot;

  • Add your bot to wanted channels;

Features

Incoming

Outgoing

Reference

Incoming

You can listen to incoming event easily with Botpress by using bp built-in hear function. You only need to listen to specific Rocket.Chat event to be able to react to user's actions.

bp.hear({platform:'rocketchat', type: 'message', text:'hello'}, async (event, next) => {
  await bp.rocketchat.sendMessage(event.channel, 'Hi I\'m alive', {})
  next()
})

In fact, this module preprocesses messages and send them to incoming middlewares. When you build a bot or a module, you can access to all information about incoming messages that have been send to middlewares.

All your flow implementation will work with Rocket.Chat too.

await bp.middlewares.sendIncoming({
    platform: 'rocketchat',
    type: 'message',
    text: message.msg,
    user: user,
    channel: message.rid,
    ts: message.ts.$date,
    direct: false,
    roomType: meta.roomType,
    raw: message
})

Profile

You can acces to all user's profile information by using this module. A cache have been implemented to fetch all information about users and this information is sent to middlewares.

{
    id: id,
    userId: userId,
    username: message.u.username,
    platform: 'rocketchat',
    first_name: message.u.name,
    number: userId
}

Note: All new users are automatically saved by this module in Botpress built-in database (bp.db).

Text messages

An event is sent to middlewares for each incoming text message from Rocket.Chat platform with all specific information.

{
    platform: 'rocketchat',
    type: 'message',
    text: message.msg,
    user: user,
    channel: message.rid,
    ts: message.ts.$date,
    direct: false,
    roomType: meta.roomType,
    raw: message
}

Then, you can listen easily to this event in your module or bot

bp.hear('hello')

Outgoing

By using our module, you can send any text or attachment you want to your users on Rocket.Chat.

Text messages

In code, it is simple to send a message text to a specific users or channels.

sendMessage(msg, options, event) -> Promise

Arguments
  1. msg (String / Object): Message that will be send to user.

  2. options (Object): Needed options.

  3. event (Object): Contain the message, user and options data.

Save users in Database

Users are automatically persisted in the built-in botpress database using the built-in bp.db.saveUser function.

Community

There's a Rocket.Chat where you are welcome to join us, ask any question and even help others.

Check our repositories too:

botpress-kick-start

botpress-channel-rocketchat

License

botpress-rocketchat is licensed under AGPL-3.0