2. Understanding your users

In the previous tutorial, we created a new bot and added a greeting block. Now it's time to make your bot able to understand its users by powering it with our Natural Language Processing engine.

📚 A bit of theory: NLP

Before we continue with ChooChoo, let's take you through some concepts that you need to know to grasp how your chatbot can actually understand what users are saying.

The science behind a bot able to understand humans is called Natural Language Processing, or NLP. In Chatlayer, building an NLP model is done in 3 steps:

  1. Define what the users would mean (or the intents)

  2. Define how users could formulate those intents (or the expressions)

  3. With those intents and expressions, train the NLP model so your bot learns to label expressions with intents

We will build an NLP model together for ChooChoo, but first, let's go through theory in a bit more details 👇

The NLP engine

To build a chatbot that responds differently depending on what is asked, it is key to understand what the NLP engine is.

The Natural Language Processing (NLP) engine is the underlying AI algorithm that allows the bot to understand what the user is saying. And as each language has its own words and grammar, we have a separate NLP model for each language!

To be efficient, the NLP model of your bot needs to be trained. You will learn how to do that in the steps below.

Understanding language isn't easy: it takes us humans about 6 years and hundreds of examples to understand the most common 20,000 words. It's not so different for computers either. To train an NLP engine, we need huge amounts of data. Luckily, we rely on pre-trained models that have a lot of smarts built in already. Check this tab to go deeper in everything there is to know about NLP.

The NLP of your bot is configured by making groups of expressions that we call intents 👇

Intents and expressions

An intent is a series of expressions (or utterances) that mean the same intention or goal from the user side. During the conversation, intents are recognised by the NLP engine and serve to steer the conversation in different ways.

For example: an intent can be a question, a statement, an answer to a question, or a greeting. Each intent can be expressed in many different ways, which is why we call them expressions.

Here are some examples of intents and some expressions to formulate them:


Book train ticket

I want to book a train ticket

I need to go from Antwerp to Brussels

Can I order a ticket here?

Who are you

what is your name?

what can you do?

what should I call you?





Let's now incorporate those concepts to ChooChoo.

Step 3: Adding an intent

We want to give ChooChoo the ability to answer basic questions about itself. To get started, we will create an intent for the question: Who are you?

  • On the left side of the screen in the navigation menu, click on NLP to navigate to the NLP module. Click the Intents submenu.

  • Click on Add Intent and name it Who are you. You can also add a short Intent Description. Click Create to save it.

  • Now you see that the intent is successfully created, without any expressions added to it (that is what the '0' means below the language)

Yet, since this intent has 0 expressions, this means that it cannot be recognised by the NLP model. Next step is about filling this newly-created intent with different expressions in natural language 👇

Step 4: Adding expressions

Now we have to make sure the NLP recognises the intent that was just created. This can be done by feeding the model with expressions.

Expressions are different ways your users will express one intent. In bot building, as in real life, there are more ways to say something or ask a question.

The more expressions you add to an Intent, the more accurately this intent will be recognised by the NLP engine. It is crucial for an intent to have a wide variety of expressions to give accurate results. Learn more about NLP best practices here.

  • Select the Who are you intent in the Intents pane on the left hand side

  • The Expressions pane will open in the right. Click on Add Expression

  • Enter Who are you? in the open text field, under Expression.

  • Click on Create

After you have finished your first expression, press Shift + Enter to save that Expression and immediately add a new one

Add some more expressions by clicking Add Expression:

  • What is your name?

  • Can I know your name?

  • Tell me more about yourself

  • Please, I'd like to know who I am talking to

  • How should I call you?

  • Who is Choo Choo?

  • Tell me what your name is

  • Who are ya?

  • What do people call you?

  • Are you a train?

  • Do you have a name?

This will result in the following screen:

Let's try adding another intent and expressions:

Add another intent, like Greeting and add some expressions:

  • Hi

  • Hello

  • Hey

  • Hi there

  • Good morning

We have defined 2 intents now: Who are you and Greeting.

However, if we were now to say 'Good morning' to the bot emulator, nothing will happen. That is because the NLP is not trained yet, and the intent is not yet linked to a block. We will work on that in the next steps.

Step 5: Training the model

To make sure the bot can use the intents with expressions that were created, we now need to update or train the NLP.

Updating the NLP means that the newly added intents and expressions will be learned by the bot so that it can recognise a wide range of expressions as belonging to the correct intent. This step is crucial: if you do not update the NLP, the bot has no knowledge of natural language understanding.

To successfully train the NLP, you need to have at least two intents with a minimum of 5 expressions each. Learn more about NLP best practices here.

  • Click the Update NLP button in the top right corner of the screen:

  • Select the language you used to add the expressions. You can view the status of the NLP update for each language by clicking on the Update NLP icon.

  • Click on Update to start the training. This can take a couple of minutes to one hour depending on the size of your chatbot. The more complex, the longer it will take.

That was a great first step to be able use the 'Greeting' and 'How are you' intent. The next step is to link these intents in the blocks so that the bot can respond to them.

Step 6: Linking an intent with a block

You have now taught the NLP to understand intents, congrats!

The only thing left to do is teaching ChooChoo how to respond. This means we are going to choose what the response (or flow) should be for each intent.

Blocks can be reached from any point in the conversation by being triggered by an intent. You can use the same intent to trigger different blocks by using context.

Let's add a new block that will serve as a response to the intent Who are you:

  • Click on Bot Dialogs menu to open the Flow tab

  • Open the General flow

  • From the right-hand side menu, drag and drop a Bot Message in your canvas

  • This will open up the Bot message and will look like so:

  • To add text to this message, click on Text and write the sentence as in the image below:

  • On top of the window, click on Settings to open the bot settings

  • Under Bot dialog name, change its name to I'm a chatbot

  • Click on Create to save your changes. This block should now appear on your canvas with the filled text and new title given.

  • Now, let's add our intent to the canvas. From the right-hand menu, drag and drop an Intent to the canvas:

  • This will open the intent. Under Select intent, select Who are you

  • Under Go-To, select the block we have just created, which should be named I'm a chatbot.

  • Click Create to save your changes

  • Your intent now appears on the canvas as a green label linked to its block, and you can move it by dragging it wherever you like on the canvas

If you now say 'Who are you' in the emulator, you immediately get the response that is typed in the 'Who are you' block. The block and the intent are successfully linked! 👏

Lesson recap

Now, you have a bot with the following configuration:

  • 2 intents ('Greeting' and 'Who are you') and their expressions

  • A bot message 'Who are you', with the intent 'Who are you' and four text messages in it.

You should now be familiar with:

  • Adding an intent to a block

  • Creating intents and expressions

  • Training the NLP to use these intents and expressions

  • Adding multiple text messages in one bot message

  • Testing your intent and messages in the emulator

If any of these topics are difficult for you, revisit them in the tutorial or search on the page in the top right search bar to learn more about a topic.

In the next tutorial we'll be gathering user input for booking a train ticket. Check the rest of the tutorial to learn more 👉🏻

Last updated