How to use rasa core bot server in a web app?


Earlier i.e when rasa core was at 0.10 version. We had /parse endpoint for accessing rasa bot http server. From newer versions /parse is being removed. I have a bot model on 0.11 but now i am not able to integrate it with my web client which is on node.js.

Has any one tried or designed any http api architecture for this then please help!

FYI - Here i want the bot i.e rasa core model to handle all the conversation flow logic by custom actions which i have implemented and all the API calling at my client end i.e at my node app end.

you can check this article , written on 0.11 however

hey! thanks for the reply and the blog is of great help but i have an issue i.e here i want the 3rd party API handling at my client side i want my custom actions to handle conversation flow only .

I am not sure what you mean ?

their are API’s which my bot will call for some actual work to do for instance calling an API to verify employee code for verifying or authenticating the user.

Till now my bot is only doing abstract work, like in your blog you have suggested to handle API calling in custom actions but here i do not want my custom actions to handle API calls. Here i want my client (node app mentioned above ) to handle all the API calling like employee verification, mobile number check and etc.

I hope this helps you to understand!

That pattern has changed now. In the previous pattern, Rasa was more of consult mode but in the new one, it is more how it sits in between.

You can use a the node app to act as a custom action server as well and return the values back to rasa core

FE —> Node App(Middleware) --> Rasa(ML) --> Node App(executing custom action)

Return of the execution of the Node App could simply pass through Rasa

the advantage is having Rasa manage the templates

how can i do that? the node execution of custom action?

have you tried creating action server on any other language?

Right now as far as i am getting we have created the action server on python and have passed its url as an endpoint to the core server. Now i have to write the code for action server in other language like node or etc and have to pass its host url to the core endpoint.

In the action server we have actions like this -

class ActionCheckRestaurants(Action):

def name(self): # type: () -> Text return “action_check_restaurants”

def run(self, dispatcher, tracker, domain): # type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict[Text, Any]]

  cuisine = tracker.get_slot('cuisine')
  q = "select * from restaurants where cuisine='{0}' limit 1".format(cuisine)
  result = db.query(q)

  return [SlotSet("matches", result if result is not None else [])]

Here we can set slots and use tracker and set action names and etc in python but how can we mention these in other language ?

I hope you are getting what i am trying to ask!?

Hey I’m on a similar boat, did you find a solution for this?

@goforbg - since this thread is a million years older :smiley: can you tell in detail what is the issue?

1 Like

I’m still a beginner so I’m sorry if it sounds wrong.

Simply put, let’s say I have

  1. a Node js server that receives a webhook from slack
  2. A rasa core + nlu server that decides what the intent is
  3. A cloud mongo db database.

Slack gives me a webhook post api to my node js server saying hey, Souvik liked your post.

I then forward it to rasa server which responds to slack?

Is this how I should architect my slack + ms teams bot? Or should the rasa server return the information back to node js app and the node js app responds to slack after doing db stuff?

well rasa has connectors now, so simply put you can just connect your channels(slack, msteams) directly to rasa and rasa can predict an action which can be handled by your actions server which can be in python(using rasa-sdk) or node js where rasa will post a webhook to your actions server.