Making a General Chatbot

Written By Chetan Iterate ()

Updated at January 5th, 2021

Until now, we know that in interplay we can create our web-based application very easily but do you know that we can make chatbots also! And it is easier than ever! Here in this example, we are going to create a basic chatbot in socket connection using RASA.


1) Find and drop the "Websocket in" component which looked like this: 

2) Now comes the important part; as we know the basic chatbot works with input data and responds to it, who is making the decision which query is to be processed in a particular manner.

to make our input in linear as possible we first change it into lowercase, by function look like this:

 Search the "switch" component, and drop the component "switch". It looks like this: The switch properties can be changed with each input word and output flow can be assigned at an outward node as like here we creating output switch by output.


1) Denotes the arithmetic relation should be associated with a given payload object, eg. in the given example the string Hello switch should be triggered to no. 1 output.

2) Denotes the payload object which is compared to input as required.

3) The switch number has to be assigned.

With this explanation, we have added other options that are later used for the flow process.

After that, we can see there are 10 outputs ready to be assigned for each switch. The first is used for generating payload for socket connection and others are actual responses required to be compared with the incoming payload. Let's connect the greeting message with a greeting and leave a message by two separate handlers, the 'otherwise' handler is assigned for generating HTTP request to an output web socket.

4) Drag for node.js function which looks like this:

and HTTP inject like this: 

Duplicate the function node and keep one for greeting and one for farewell and HTTP request, keep the request parameters as:5) As usual, we need to return our response to the chatbot console. Hence we need a "Socket out" node which looks like this:6) Modify its parameters so that the target be directed towards chatbot, for example, our chatbot parameters are like: 

7) Join nodes and deploy the flow which can look like:

Let's try our chatbot:

Have a pat on your back, it's ready!

Was this article helpful?