How to Build a Chatbot with RASA : Complete Guide

How to Build a Chatbot with RASA

Remember Last time when you visit any crowded place like Metro or Railways etc . You must have seen long Queue  . Just think ,Can you do something to transform their life ?  Of course  You can do . You can make any online portal ,So people can get information on single click . This can solve the problem of Queue but users need to understand User Interface . Lets think about chatbots  , If you can make a chat bot or virtual assistance for this long queue .You can not only solve problem but transform the user experience.With chatbot they will start enjoying the conversation . Actually good designed chatbot gives human like feeling . I know you are too smart and quickly come to the point So  You must be Thinking , How to build a chatbot ?  Right !

If you have similar queries in your mind , This blog is best fit for you . You will learn end to end chatbot development with RASA . If you are completely beginner in chatbot development  , I will recommend you to read the starter article of chatbot series- “ What is chatbot : An Artificial Intelligence Insight ” . In case you are looking for learning resources for chatbot development , You may turn your eyes here – Best Artificial Intelligence chatbot development video resources .



How to build a chatbot with RASA [rasa end to end] ?

If you love to read Tech magazines or Tech Blogs ( Chatbot related)  on Internet , You must have heard about efforts of Top IT companies like IBM ,GOOGLE and Amazon etc in chat-bot development . Most of these companies have provided their own chat bot framework.  Google has recently acquired API.AI . Google has changed its name by dialogflow . In the similar fashion , Amazon has Lex and Facebook has Wit.AI. Mostly these Platforms are cloud based. I can guess you doubt now . You must be thinking if there are so many NLU and chatbot development frameworks are already there then why to choose RASA ?

RASA stack is an open source AI tool . Being an opensource Framework, It is easy to customize . In fact , In many cases Clients do not want to share their data .As I have already told you , Others  NLU are cloud based, They provide software as service   . You can not run them internally in your environment. So you need to send your data to third party . With RASA , There is no such issue . You can deploy or host Rasa Internally in your server or environment.

How to build a chatbot with RASA 1
How to build a chatbot with RASA 1                                                 Image Cropped from :

What is the Difference between RASA NLU and RASA CORE ?

RASA CORE  and RASA NLU are the part of RASA stack. Rasa NLU provides the capability of classification of Intent and Entity Extraction .Basically RASA NLU handles all NLP stuffs   .People some time say playing around chatbot seems like a magic show , So the Magic behind any chatbot is its NLU  . This NLU classify unstructured data into structured one like JSON  . In the opposite side , RASA Core handles end to end chat flow . Actually When we send any sentence to chatbot  .It first passes through any NLU . This NLU classify the intent and Extract the entity out of that sentence .Now RASA core comes into role , It gives the direction further and create the user response . You will get deep information with all these stuff later in this article . To make you more comfortable with Chatbot Terminologies and Technologies , We have designed a very informative article -” know the underline technology behind artificial intelligence chat bot “.

Till now , We have covered the basic information needed for chatbot development .Its time for Real Development .

Training RASA NLU  –

In this section we are training RASA NLU with our training dataset .  So before going to any technical stuff , lets see the outcome of our learning. You will get this response after following the below mention steps –

How to build a chatbot rasa NLU output
How to build a chatbot rasa NLU output

I have taken the screen shot of response generated by RASA NLU . If you refer the above image ,You will see I have hit a request on “http://localhost:5000/parse?q=hi”  . Basically After training the RASA NLU , I run the model on my local host at port 5000  .  Where I send the ‘hi’ as user input text .Rasa NLU is creating a JSON object at this request which classified  the intent name with its confidence score . Actually there is no entity in user input text .so this list is blank  . To make all the procedure clear  Here is the screen shot of that server –

How to build a chatbot RASA NLU SERVER
How to build a chatbot RASA NLU SERVER

I hope now you have understood ” What does the outcome response RASA NLU generate on user input text ” . So Lets focus on  How to achieve it . You need to follow the below steps –

Installation of RASA NLU –

To be very frank , Going to the official document of RASA  is one of the best option if you have too much time  . In case If are in hurry follow these steps  . These are straight forward steps  to setup Rasa chatbot NLU from scratch . I am also listing the probable errors and its solution while installation –

1. Open command prompt and type –  

pip install rasa_nlu

2. Back end Set up –

pip install -U spacy 
python -m spacy download en

Note – While running these two commands usually we encounter few errors . It is completely version related or missing  dependencies related . I will share all screen shots with and the steps taken to resolve them –


  1. Microsoft Visual C++ related error
    How to buid a chatbot error in Rasa Installation
    How to buid a chatbot error in Rasa Installation

    Now you need to Install Microsoft visual C++ .

JAVA Home Related Error Handling –

Its very common error , Usually every programmer must have faced this situation . You have to just set Java_Home variable in you environment . Thats it . One more thing to remember  , If you get any of the above error , You resolved that .Try to re open the cmd and type the above command . If you get any access denied type error , Do not forget to start your cmd in administrator privileges .

Congratulation .  We have done with the installation of RASA NLU . See Its time to define your entities and Intents .I will suggest you to clone the git hub repository of RASA NLU .I suggested you to clone because it contains some examples for training data . I will try to explain using them .

Once you clone You will get the Project Structure like this . Remember what ever command I suggest you to run for training this NLU . You have to run at the path in “Directory_Where_You_Clone/rasa_nlu“.

If you need to look at the training data ,  You will  at the location -“Directory_Where_You_Clone/rasa_nlu/data/examples/rasa

These are JSON training set for Entity and Intents . Now the wonderful part with RASA NLU is you can configure pipeline . Do not be confuse with the pipeline . Actually before Intent classification or Entity extraction in RASA NLU , It has to passes from different components . You can create custom components in RASA NLU . Few of the pipeline are pre configure . I have also highlighted the folder sample_configs in the below image . This contains few JSON  files which stores the pipeline of components .

How to build a chatbot RASA NLU
How to build a chatbot RASA NLU

Command set use to Train and Run RASA NLU Server  –

python -m rasa_nlu.train -c sample_configs/config_spacy.json

This command will train your RASA NLU . It will create a model inside “rasa_nlu\projects\default” . Now If every thing is one the right direction . You can run the RASA NLU server . To Run the RASA NLU server use the command –

python -m rasa_nlu.server -c sample_configs/config_spacy.json

Now We have reached the place where we have our NLU server working . To check the response , You can use POSTMAN or Browser as it is GET request . Use url –


Now you can expect the response like the image we have shown at the start of this section .

How to create Custom Training data set for RASA NLU ?

As I have mentioned how to train and Run the RASA NLU server . But There were using the dummy example data set . It was just to demonstrate you only . But Now the question gets up how to prepare the custom training data set for RASA NLU . See In the above example we have seen that the training dataset which we seen is of JSON format . Obviously creating that json data manually is a big task .But Do not worry . There is a UI for creating that data set .Here is the official link for GUI RASA NLU Trainer .



Start Getting response Using RASA Core [rasa core tutorial]-

Intent classification and Entity Extraction coverts unstructured data into structured one . Now we need to process this Structured JSON and produce some response for user’s query . To accomplish this end to end conversation RASA has designed the Module RASA Core . It is loosely coupled designed so that you can replace RASA NLU and use other market NLU like Dialogflow , Lex . It is not recommended but obviously a choice . Here are some steps for start working with RASA core –

Installation of RASA Core –

Install RASA Core using the command on cmd or Terminal –      . 

pip install rasa_core

 I am assuming you must have follow the section of RASA NLU . So must have installed that . Like every other framework , Rasa also need some directory structure .Either you can create these folder structure or you can clone the git hub rasa core repository . This contains some examples  . In starting I will suggest you to customize them and run the Rasa Core Server first . This will give you better understanding .Few words for Rasa Project elements like , Domain.yml –

  1. So file contains the direction for your conversation . Suppose RASA NLU identifies any intents , Now RASA CORE will generate the response on the basis of this file . It actually contains the roadmap for Actions and Intents .
  2. Domain.yml – this file contains all the information about your not . Here you need to put the name of aall intents , actions ,slots etc .
  3. nlu-config.json – it contains the information about the model and underline component of NLU model . Here is a sample config file –
    How to build a chatbot - NLU CONFIG.JSON
    How to build a chatbot – NLU CONFIG.JSON

    Command set use to Train and Run RASA Core Server –

    Before running any command , Make sure you are in the same directory where your example rasa projects are checkout . As we have done in NLU part already .

    1.As we already trained our NLU but this is new directory checkout so it has different config.json file .So you need to run the command for training the NLU again . This will create new NLU model .

    python -m rasa_nlu.train -c nlu_model_config.json --fixed_model_name current

    2. Now you need to train RASA CORE . So you can use the command –

    python -m rasa_core.train -s data/ -d domain.yml -o models/dialogue --epochs 300

    3. Now you need to run the server for Rasa Core . This command will work for you –

    python -m -d models/dialogue -u models/nlu/current

    How to create Custom Action is RASA Core –

    I have already told you that when you checkout the git repository of RASA Core You will get the some example project there –

    How to build a chatbot RASA NLU github repo
    How to build a chatbot RASA NLU github repo

    Go inside concertboot by Rasa Official and you will see . In same way you can also make your custom python script . Only you need to mention it on and Domain.yml . See the example carefully it will better explain you .

    Integration with Chatting platform –

    Rasa is designed to support many chatting platform but officially till version (0.7.9),  rasa has provided the only integration support with Facebook messenger and command line . If you want create integration for skype and slack etc , you have to create your own under the channel module of rasa core . You can take as an example guide for you . I guess in few release , you will automatically get the solution for these integration .

    I have given command set to run and interact with Rasa server from command line . If you need Facebook integration ,You have to create a credential.yml file . This contains all the parameter information required to ,make a connection from  Facebook page and rasa server . Now You have to run the command –

    python -m -d models/dialogue -u models/nlu/current -p Port_Number -c facebook --credentials credentials.yml

    Rasa Community support –

    Rasa is very nice community support . You may ask your doubt and give suggestion to others . It has different section  for chat topic . Best part of this community it is hyper active .

    How to build a chatbot- Rasa Community
    How to build a chatbot- Rasa Community

    EndNote –

    Chatbot can solve most of the service related business problems . Actually, Chat bot development is a hot topic in AI industry and matter of research today .  I hope this article must have solved your query related to How to build a chatbot with Rasa .Anyways Do not forget to subscribe our blog for latest update from chatbot world . You may write your suggestions and comment in comment box below . You may also request new articles , You enjoy to interact with you . In the meantime you can like our Page. 


    Data Science Learner Team 


Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages, where he and his team share knowledge and help others learn more about data science.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner