New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

botkit-rasa

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botkit-rasa

This plugin provides Botkit developers a way to use the [Rasa NLU](https://rasa.ai/) open source, self hosted natural language API.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-44.44%
Maintainers
1
Weekly downloads
 
Created
Source

Botkit / Rasa NLU plugin

This plugin provides Botkit developers a way to use the Rasa NLU open source, self hosted natural language API.

Setup in your project

Install the plugin using the npm package

npm i --save botkit-rasa

Make your bot aware of the plugin:

var rasa = require('botkit-rasa')({rasa_uri: 'http://localhost:5000'});
controller.middleware.receive.use(rasa.receive);

controller.hears(['my_intent'],'message_received', rasa.hears, function(bot, message) {

    console.log('Intent:', message.intent);
    console.log('Entities:', message.entities);    

});

Example Slack bot

In the example directory there's a fully functional Slack bot sample.

This bot demonstrates some core features of Botkit leveraging Rasa NLU plugin:

  • Connect to Slack using the real time API
  • Receive messages based on "spoken" patterns
  • Reply to messages

Prerequisites

Run the example bot

Get Rasa NLU up and running by checking out their repository and following the instructions to setup a Rasa NLU instance. At this point you should have a Rasa NLU instance up and running.

Now get a Bot token from Slack (you will need this later when launching the bot from the command line):

Clone this repository and move into the example directory:

  • git clone https://github.com/sohlex/botkit-rasa.git

Open another terminal and from the example directory, run the commands (TOKEN is the one that you got before from the slack website):

  • npm install
  • slack_token=<TOKEN> node bot.js

Use the bot

Find your bot inside Slack to send it a direct message.

Say: "Hello"

The bot should reply "Hello!" If it didn't, there's a problem with Rasa NLU configuration, check the bot and Rasa console for errors.

Make sure to invite your bot into other channels using /invite @!

Extend the bot

If this middleware doesn't satisfy your needs, you can use it as inspiration for your implementations or contribute to this project! Furthermore, Botkit has many features for building cool and useful bots!

Read all about it here.

What this middleware does

Using this Rasa NLU middleware plugin for Botkit causes every message that is sent to your bot to be first sent to Rasa NLU for processing. The results of the call to Rasa NLU are added into the incoming message as message.intents and message.entities.

Using the Rasa NLU hears middleware tells Botkit to look for Rasa NLU intents information, and match them using this information instead of the built in pattern matching function.

You must create an intent in the understandings area of Rasa NLU and train it to register certain expressions.

More informations are available in the Rasa NLU documentation

Keywords

FAQs

Package last updated on 14 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc