Skip to content
This repository has been archived by the owner on Mar 18, 2020. It is now read-only.

broidHQ/broid-kit-botpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm node bithound bithoundscore nsp-checked

Broid Kit Botpress

Broid Kit Botpress is a broid-kit middlewares that integrates botpress with Broid Integrations which allows you to leverage the largest collection of messaging channels integrated in a single framework.

This middleware supports only Incoming messages (communication channel -> broid -> botpress), Outgoing is not supported (there is no way to pass messages from botpress -> broid -> communication channel, the only option is broid -> communication channel).

Connect your application to multiple messaging channels using W3C Open standards.

gitter join-slack

Quick Example

const path = require("path");
const Bot = require("@broid/kit");
const BroidDiscord = require("@broid/kit-botpress");
const BroidMessenger = require("@broid/messenger");
const BroidSlack = require("@broid/slack");

const bot = new Bot({
  logLevel: "info",
  http: {
    host: "0.0.0.0",
    port: 8080,
  }
});

bot.use(new BroidSlack(<...options>));
bot.use(new BroidDiscord(<...options>));
bot.use(new BroidMessenger(<...options>));
bot.use(new BroidKitBotpress({
  botpressPath: path.join(__dirname, 'botpress')
}));

// Listening for public starting by `hello`
bot.hear("hello.*", "Group")
  .subscribe((data) => {
    console.log("Data:", JSON.stringify(data, null, 2));

    // Reply to the message
    bot.sendText("Hi, How are you?", data.raw);
  });

Documentation

Quick Start

  1. Create a new node project
$ npm init
  1. Install and initialize a new botpress project
$ npm -g i botpress
$ mkdir botpress && cd botpress && botpress init

Take a coffee ;)

  1. Install broid-kit
$ cd .. && npm i --save @broid/kit
  1. Install all the broid integrations you need. You can see the full list here
$ npm i --save @broid/skype @broid/slack @broid/messenger @broid/discord
  1. Install broid-kit-botpress
$ npm i --save @broid/kit-botpress
  1. Copy past the basic code and play with it!
const path = require("path");
const Bot = require("@broid/kit");
const BroidSLack = require("@broid/slack");
const BroidDiscord = require("@broid/kit-botpress");
const BroidMessenger = require("@broid/messenger");
const BroidKitBotpress = require("@broid/kit-botpress");

const bot = new Bot({
  logLevel: "info",
  http: {
    host: "0.0.0.0",
    port: 8080,
  }
});

bot.use(new BroidSlack(<...options>));
bot.use(new BroidDiscord(<...options>));
bot.use(new BroidMessenger(<...options>));

bot.use(new BroidKitBotpress({
  botpressPath: path.join(__dirname, 'botpress')
}));

bot.hear('.*', 'Person')
  .subscribe((data) => {
    console.log("hear data", data);
  });