Tutorial

In this tutorial, we are going to use AEI Studio to create a simple bot that can answer to greetings and ask for the user’s name. This will involve all the important concepts of a skill: intents, entities, slots and stories.

If you haven’t done so already, go to the AEI Studio Console and create an account.

We are going to develop a conversation as shown below:

Conversation 1: User greets for the first time

- User: Hi
- Bot: Hi! What’s your name?
- User: My name is John
- Bot: Nice to meet you, John

Conversation 2: User greets again

- User: Hello
- Bot: Hi John!

Creating the Skill

The first step is to create an empty skill, which you can do directly from the homepage. Give it a name and a description, and change the category or the icon if you want. We will use English for this tutorial.

Once the skill is created, you get redirected to the Inputs tab, where we will create intents and entities.

Intents

Based on the sample conversations above, we can see that our user can tell the bot 2 different things:

  • say hi
  • tell their name

We will create an intent for each of them.

To create the first intent, click the Create button next to Local Intents. We will name it say hi and provide some examples as shown below:

Feel free to add more examples if you know other ways to say hi!

Then we create another intent called tell name with examples showing possible answers to the question What’s your name?.

We can now test whether our intents are recognized. If you click the Test on the right of the screen, you can input some test query and see which intent the bot finds. If you try My name is Bob, which was not provided as an example but is close enough to other examples, you can see the intent tell name is found.

Entities

You might have noticed in the example above that there was no entities found. That’s not what we want: we need Bob to be extracted as an entity so that the bot can save it for reuse. To achieve this, we need to teach the bot how to recognize those entities.

Reopen the tell name intent and select the name in the first example (John). Click on Type entity name in the pop-up menu, and input name. The word John should now appear tagged with some color. Repeat the operation with all the other names, but this time just select name in the list of entities. The final result should be as shown below.

The test panel should now recognize Bob as an entity of type name:

If you want to improve the ability of the bot to recognize names, you can click on the entity name from the entities list, then Add multiple values and copy paste a list of names you can easily find on the Internet.

When the bot is learning, it will automatically generate more examples using those names, which should improve its accuracy.

Slots

Once the bot extracts a name entity, we want to save it into a slot. Two reasons for that: slots can be remembered over time, and they can be used in Replies.

Go to the Slots tab and click Create next to Local Slots. We will call the slot name and use a lifespan of Forever, which means once the user told their name to the bot, the bot will remember it forever.

The logic behind saving the entity into a slot will be configured later in Stories.

Replies

In the Replies tab, we will enter all the possible answers the bot can give. As seen in the sample conversations, we have 3 cases so we need to create 3 replies:

  • Hi! What’s your name?
  • Nice to meet you, name
  • Hi name!

Here name is our previously created slot. To insert it into the reply, click the slot menu next to the reply input field and select name.

The list of replies should be as follows:

Stories

This is the most important part of the skill creation, where we connect all our components together. We have 3 scenarios:

  1. when the user says hi, if we don’t know their name, we ask for it
  2. when the user says hi, if we know their name, we say hi back with their name
  3. when the user says their name, we save it and say “Nice to meet you”

Let’s create the first story. We will call it say hi.

  • Next to When, select the intent say hi.
  • Next to then, select check slot, which means we will have different logic depending on the value of the slot. Pick our slot name.
  • In the first if condition, select is missing and link it to our reply “Hi! What’s your name?”. This is what the bot will reply when the slot has no value yet.
  • Add another if condition with value is defined and link it to our reply “Hi name!”. This is what the bot will reply when the slot has a value.

The story should look like this:

Now let’s create a second story part within the same story. This means we expect something to follow the part we just created.

  • Click Add Story Part
  • Next to When, select the intent tell name and add name to the list of required entities.
  • Next to then, select save entity and pick both the name entity and the name slot.
  • Add another then clause with our reply “Nice to meet you, name”.

It should look like this:

We’re done with the skill! The next section will show you how to create a bot and test our skill, but before that a last step is necessary: we need to publish the skill. Go the Versions tab, click Publish and validate.

Creating the Bot

Go to the bot menu and create a new bot. This is done in 2 steps:

  • configure the identity of the bot: a name, an avatar, etc. The fallback message is what the bot will reply if it doesn’t understand the user (no intent found or no story for this intent).
  • choose the skills that will make the brain of the bot. Pick the skill we just created.

Once the bot is created, you should notice a Simulator button in the bottom right of the screen. Click it to open the chat window. Try saying hi!

The following conversation should work now:

Congratulations, you created you first bot!

Next Steps

  • Add more examples of intents and entities to help the bot understand a wider range of expressions and names
  • Once this scenario is working well, you can create more intents and stories to handle questions such as How are you?, Good bye, etc.
  • Check out the Integrations tab of your bot to make it available on Slack, Telegram or even your website.
  • Peruse the Documentation to discover the advanced features of bots and skills that will allow you to handle more complex conversations
  • Look at public skills shared by other users to see how they were made