This workshop was adapted from a workshop made by Justine Baron, posted on the Recast.AI website. It is available at https://recast.ai/blog/build-your-first-bot-with-recast-ai/
Recast.AI is a platform for building and trianing bots. We will utilize their services to get started on basic bot-making.
Once you’re logged in, you can create your first bot. Click on the button
Start with a template, or just on
+ NEW BOT in the header section.
Create a complete chatbot.
You can choose one or many pre-defined skills for you bot. This will help you get started faster. Just select
Greetings for now, but I encourage you to check the others later.
Choose your name.
joke-bot would be appropriate.
Add a description.
My funny joke bot or something similarly descriptive.
English as the default language.
You can keep your bot public as there is no private info, but you can change this setting later.
There are 5 phases in your bot life, represented on the Recast.AI platform through the use of 5 tabs:
For this tutorial, we’ll skip the
Code part, because we won’t need any external information. In future tutorials, we will rely on code more and more as our bot-making skills increase.
This is the brain of your bot, where all its understanding is gathered, divided into intents.
An intent is a “box” of sentences that all carry the same meaning, even though they can be very different to one another. When a user sends some text to your bot, our algorithm compares it to the phrases in your intents. Then it checks if it’s close enough to one of them and decides what the intention of the message is.
Are you a bot? <br> You reply so fast, I’m sure you must be some kind of robot. <br> Am I speaking to a human or not?
are all different, but they all ask the same question that we can can sum up as:
Are you a bot?
That would make a great intent! If your bot is able to recognize this question, you can prepare a smart reaction, like
I’m a robot and I’m proud of it.
All bots should understand basic things such as
disagree, or when a user asks for help.
If you chose the pre-defined Skill
Greetings when you setup your bot, you will already have two intents:
As Recast.AI is collaborative, you do not have to recreate each intent every time! You can ‘fork’ an intent someone already created to clone it right into your bot. Since we need to understand that our user wants to be told a joke, let’s find if the community has already created this intent for us.
joke in the input Search!
You can click on the intention names if you want to check their full content. The first result will work just fine for us.
If you want a custom intent, you can build it from scratch. Here, we want the bot to understand when someone laughs at the joke.
+ CREATE on the right of the search field, and choose a name for your intent:
Repeat this process for intent that gathers negative reactions to your jokes:
Now that we have intents, we need to populate them with various expressions. An expression is the name of a sentence added to an intent.
A golden rule would be to add 20 expressions to an intent for a development bot, and 50 or more for a production bot.
Click on an intent and add sentences you want your bot to understand. Put yourself in the shoes of the people talking to your bot.What could they possibly ask? Enter a new expression by typing it into the field Add an expression. Here are some examples:
hahah that’s hilarious <br> ROFL you’re good! <br> That, my friend, was an amazing joke. <br> I haven’t laughed that much in a long time!
You have no sense of humour whatsoever. <br> That’s both terrible and offensive. <br> What the heck was that? <br> Try harder, that was a very bad joke
Now that your bot is full of expressions, let’s test it with the console:
Click on the TEST bubble icon on the top right, and type a sentence you have not trained your bot with, such as:
Botty bot, can you tell me a joke please?
You will see which intent was detected under
User is referring to. If the algorithm did not detect an intent, or detected an invalid intent (not the intent for asking a joke), that means that you need to train your bot with more expressions.
Once you’re happy with your bot intent detection, it’s time to move to next phase: building your bot flow.
Now that the brain of your bot is all filled up, click on the
Build tab is where you find
Bot Builder. It helps you construct the conversation flow of your bot using Skills.
Each Skill represents one thing that your bot knows how to do, and they can interact with each other. Your skill can be a complicated one – such as managing payment by credit or simple – answering basic questions
When you create a new bot, forking skills you already made to the new one will keep making your bots more powerful. You can also fork skills created by other people on the platform, so you don’t have to reinvent the wheel!
If you chose the pre-defined skill
Greetings during the creation of your bot, it will already be in your interface.
Click its name to check its details.
A skill has four parts:
If you navigate through the tabs, you’ll see that this skill is structured as follows:
It’s time to create our own Skill with the same structure.
Go back to the Build tab and click on
+ Create skill on the left.
You have three different types of skills:
Fallback. On the one hand,
Floating have no structural differences. Yet differentiating the two types of skill helps when you have a lot of them.
Fallback skills, on the other hand, trigger when no other skill has their Triggers fulfilled after a user message. Most of the time, you’ll have only one of this kind, where you can remind the user what your bot can do, and ask them to rephrase.
Our skill will be of
Floating type. Give it the name you want, I chose
Double-click on the skill and go to the
Triggers tab. We want to activate our skill if one of the three intentions we created are matched.
Click on the bottom
+ button to add a new condition. Don’t forget to change the condition to
OR by clicking on
AND, since it is an
AND condition by default and we want to activate our skill when any of these intentions are matched.
We won’t need to do anything in the Requirements, because we don’t have anything to ask. But you can improve the bot by asking for some information there, like what kind of jokes they prefer, or how old they are if you want to add some adult jokes.
Head to the Actions tab and create your first message group by clicking
ADD NEW MWSSAGE GROUP.
ADD CONDITION to trigger messages and add the condition:
If @ask-joke is-present. The
@ stands for intent type. We’ll cover other types later.
Then choose the action type
SEND MESSAGE, choose Text format and type the best joke you know:
Click on the little
+ over your message to add a new message to your random list, so that we don’t always send the same joke.
If you click again on
SEND MESSAGE below, you can send multiple messages at the same time.
Let your creativity speak.
Nice! Once we’re good with our jokes, let’s cover the two other intents.
ADD A NEW MESSAGE GROUP and set as condition:
If @laughs is-present
I decided to send gifs in this case, so I clicked on
SEND MESSAGE, and
Try not to spend too much time searching for images or gifs on Google. ALso, if the image doesn’t autmatically show up, it doesn’t work. I’m sorry but you have to pick a different one.
P.S. In order to get the image url, right click on it, then select
Copy image address.
Repeat the process for the last intent.
Now, it’s time to let go the test console and deploy your bot to a public messaging platform.
Go to the
Connect tab, choose Telegram.
Go on your phone and download the Telegram app. If you dont have service or dont want to waste data, call a board member over (the school wifi blocks Telegram, so don’t waste your time trying).
Monitor tab will help you sharpen your bot’s intelligence over time.
It gathers all the messages your bot receives and shows what intent was matched.
Keep and eye on this tab and train your bot regularly:
Create a knock joke.
You will need 3 intents
Tell me a knock knock joke
Then create 3 new message groups to listen for these intents and have the bot respond to them (in the build tab)
Keep testing and trying, good luck!