rasajs v0.0.4
Creating a Chatbot for Rasa with Node.js
Introduction
Rasa is an open source conversational AI framework that allows developers to build and deploy chatbots and voice assistants. Rasa offers several language-specific APIs to interact with the framework, including a Node.js API.\ The Rasa Node.js API allows you to integrate Rasa into your Node.js applications and interact with your Rasa chatbot or voice assistant through HTTP requests. With this API, you can send messages to your chatbot, receive responses, and track conversation history.
Installation
To use the Rasa Node.js API, you'll need to install the rasajs package, which is a rasa api that gives you access rasa server. Install it by running npm by running the following command:
npm i rasajsImport
Once you have rasajs installed, you can use it to send HTTP requests to your Rasa server.
import rasa from 'rasajs';
or
const rasa= require('rasajs');Setup
After import you have to initialize the url of rasa
rasa.baseUrl("http://localhost:5005");Chat With Rasa
rasa.sendMessage("hi",res=>{
console.log(res);
});Answer should be in json format
{ text: 'hi', reply: 'Hey! How are you?' }Functions
rasa.parseModel
rasa.parseModel: (message: string, callback: Function) => voidrasa.sendMessage
rasa.sendMessage(message: string, callback: Function): Promise<void>rasa.entry
rasa.entry: () => voidrasa.addEvent
rasa.addEvent: (eventname: string, callback: Function) => voidrasa.resetEvent
rasa.resetEvent: (eventname: string, callback: Function) => voidrasa.ConversionTracker
rasa.ConversionTracker: (callback: Function) => voidrasa.chatHistory
rasa.chatHistory: (callback: Function) => voidrasa.replayDomain
rasa.replayDomain: (name: string, callback: Function) => voidrasa.injectIntent
rasa.evaluateStories: (name: string, callback: Function) => voidrasa.evaluateStories
rasa.evaluateStories: (name: string, callback: Function) => voidrasa.replaceModel
rasa.replaceModel: (path: string, callback: Function) => voidrasa.version
rasa.domain: (callback: Function) => voidrasa.domain
rasa.domain: (callback: Function) => voidrasa.status
rasa.status: (callback: Function) => voidrasa.baseUrl
rasa.baseUrl: (url: string) => void