Technology is everywhere…? Technology is everything…? Technology is with everyone…? In this generation where technology is everywhere and it is so important that the competition is at its peak. So in this huge competition, we must know how to grab the audience’s attention so that the user will choose your technology (Rasa chatbot for now) over any other technology. To learn and understand these ways to grab the audience’s attention we need to attract the audience first with the best UI that we can offer to our user. To understand this I have come up with this and the upcoming posts to make you learn different ways to attract and grab the Audience to your technology (Rasa chatbot for now).
In this post you will learn how to add the custom links to your Rasa chatbot so as to provide another way to interact with the user and to add extra features to the chatbot like the one that you will learn here is href links to redirect to the URLs.
Link or we can also call it as the hyperlink is an icon, graphic, or text that links to the other webpage or URL. We have two ways of doing this, one is to directly display the link to the user to use further or to use it as the hyperlink and set any keyword as a reference to that link and that will hide the link from the user. We will cover both the ways in this post and I’m sure you will love it when you will use it with your Rasa chatbot. Now let’s understand what actually happens when you add the links in your Rasa chatbot.
When you add the links to your rasa chatbot what happens is rasa in the backend use its a configuration file which we have with us as config.yml where there is a configuration for the regular function that checks whether the specified text is a link or not if that part is a link then it will be highlighted and will be treated as a hyperlink just like you may have done in the HTML where we use the <a href= “link-to-the-webpage”> tag to create a link. By default if you don’t specify the keyword for the link then the complete link is treated as a keyword otherwise the key is used as a reference to the link.
To learn the practical implementation of this over video the check out this video session and be an expert on this topic.
Let’s learn how to implement it in Rasa. Before starting let’s keep one thing clear in our mind that what we are going to do in this post.
For now, let’s assume that chatbot(as a waiter) and the user(as a customer) is having a conversation to place the order and suddenly the customer asked the waiter that I would like to know more about your restaurant so the basic information a waiter can easily give but to have a good impact for the restaurant the waiter decided to tell the customer about their restaurant’s official website so that the customer can check himself and get to know more and detailed about the restaurant. So, here is a small conversation for that that I’d like to add to my chatbot.
User: I would like to know more about your restaurant.
Chatbot: Here is a link for you to know more about our restaurant: “http://www.innovateyourself.in/”
So, this is a small chat that we will add to our existing rasa chatbot that we have created till now from our previous post. From this above chat now you may have a basic idea that where we have to make further changer for this chat to be implemented in our rasa chatbot. So, for this, we will make changes in the nlu.md, domain.yml, and stories.md file.
For the user text, we have to create a new intent in the nlu.md file so that our rasa chatbot can understand the text said by us and for the text said by the chatbot, we have to make changes in the domain.yml file. For this conversation to work we have to add a new story to the existing story so that our chatbot and give response accordingly.
nlu.md file after adding the changes:
## intent: more_info
- i want to know about your website
- tell me more about your site
- what about your website
- what can i get here?
- what can i have to eat?
- what can i get for the lunch?
- what is this place famous for ?
- pure veg
- pure veggie
- i want vegetarian food
- pure non-veg
- get me 1 mix veg and paneer butter masala
- i want 1 mix veg and masala mushroom
- i want green salad
- get me 1 egg curry and chicken butter masala
- i want 1 egg fry and fish curry
- i want 5 boiled eggs
- good morning
- good evening
- hey there
- see you around
- see you later
- of course
- that sounds good
- I don't think so
- don't like that
- no way
- not really
- very good
- I am feeling very good
- I am great
- I'm good
- very sad
- very bad
- not very good
- extremely sad
- so sad
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?
stories.md file after adding the changes :
## happy veg path
## happy non vegetarian path
## happy info path
Here I have added a separate story for this conversation phrase so that it won’t create any interference with the other stories.
domain.yml file after adding the changes:
- text: “Here is the link to our website: http://www.innovateyourself.in/”
- text: How can i help you sir?
- text: 'what would you prefer:'
- title: Vegetarian
- title: Non-Vegetarian
- text: 'Here are the meals for you:'
- text: 'Here are the meals for you:'
- text: Is there any thing else sir?
- text: Thanks. We will get your order shortly.
- text: Hey! How are you?
- text: 'Here is something to cheer you up:'
- text: Did that help you?
- text: Great, carry on!
- text: Bye
- text: I am a bot, powered by Rasa.
With this changes in the domain.yml file we will get the output like this:
and if the utter_info is written like this
utter_info: - text: Here is the link to our [website](http://www.innovateyourself.in/)
then your bot will give output like this:
So, these are the two ways how you can create or add the links in your rasa chatbot.
When you are done with this just train your model with the following code and run you rasa chatbot in the terminal by typing the commands.
$ rasa train
$ rasa x
This is how your rasa chatbot will work when you will run rasa x with your trained model. These are the images with and without the hyperlink.
I hope it was really helpful blog for you. But still if there are some queries related to the topic then leave a comment below in the comment section. Also provide your valuable feedback if you have like this post.
Time to wrap up now. Hope you liked our content on How to integrate Rasa chatbot on Microsoft Azure. See you in our next blog, thanks for reading our blog and do leave a comment below to help us improve the content to serve you all of our experience with you. Stay tuned with us for more Rasa Chatbot contents.
Till then stay tuned and Enjoy learning.