Start building your own chatbot now!

As a new trainee in the SAP Conversational AI team, the first thing I did was to build a Chatbot. Let’s dive into it!


For my first week in the dev team, I was asked to build a little Chatbot, to handle the SAP Conversational AI techno to help me really get to know what we were doing: an NLP platform for developers.

First things first, what is a Chatbot?

A Chatbot is a computer program designed to simulate an intelligent conversation with one or more human users via auditory or textual methods.

It’s important to understand that a bot is not an app, it’s a bunch of code running somewhere that you can plug into existing apps, whatever they are. Alright! Let’s plug our bot into Slack!


What type of Chatbot can I make ?


It has to be interactive, and much more than that, useful. It didn’t take me long to come up with something. What if I made a bot that connects people to each other?

Thanks to SAP Conversational AI NLP, I will make my program understand what the team is saying and make some suggestions.

Now, let’s make it answer their questions. Easy, I just have to know what they are talking about and provide a random answer! No way, that’s not good enough, we have to make it interactive.

Let’s do this, what do we need? First, our bot has to be able to have simple interactions, like saying hello or goodbye. Easy, just create the corresponding intents on the SAP Conversational AI platform and write some generic answers.


That’s a good start, but we now need more interactions. The purpose of the bot is to connect people with each other, so let’s make him ask people for their hobbies and things they like to do.


As we want it to connect people, we will make our bot able to retrieve information about activities people like or don’t like to do, give them information about other people’s hobbies, and suggest some activities they can do with other people in their Slack team.


How can it understand things

Now we’re diving into a much more interesting and complicated part of a Chatbot: it has to remember things. Who is it talking with? What does it know about this person?

For this we will just add a little database to our bot to remember what each person likes or doesn’t like to do.

Of course we also need to train our bot to understand what people are telling it. We do this by adding an intent with a few corresponding sample sentences. We’ll create an intent: activities and an entity: action.


Now our bot will be able to understand what people like or hate to do, but it  can also remember these for the next time they will talk to him.

That’s great but let’s go back to what we want him to do for us? What can we ask him? We could for example ask him what we can do with a specific person, to suggest something to do or, why not, what a person likes or hates.

Nice but how can we do that? Don’t panic and keep coding, SAP Conversational AI will provide us all the information contained in our users’ sentences. What is he talking about, what type of sentence is it? Is he talking about a person, or an activity in particular? Well let’s ask SAP Conversational AI after giving some examples to our bot.



Making our bot  answer correctly

Well, someone wants to do something with Jerome, let’s find them a shared hobby and inform him of their mutual interest. It may look limited, but the possibilities are infinite, we can now know if our user is asking for some general advice, or something more specific.

We just have to focus on what type of sentence it is and what it contains. If the input is Who can I play soccer with?, we’ll know that the sentence is a “who question”, and that the user is talking about playing soccer. Starting there, we can look in our memory for the users that like to play soccer and tell the user.

If the sentence is What can I do with Visjar? we’ll know that the sentence is a “what question” and that the user is talking about someone. It now has to find out what Visjar and our user have in common.


The power of SAP Conversational AI

The power of SAP Conversational AI is that it doesn’t tell you about the words in the sentence, but much more than that: about their meanings. This allows us to deal with a wide range of sentences just by knowing the meanings of their contents and not the words themselves. The next thing is that Who can I play soccer with? and Who can I meet friends with? will be the same sentence for our bot. SAP Conversational AI allows us to generalize by providing us abstraction of the sentence – e.g activities, enabling us to focus on the topic of the sentence. That said, let’s code this.


Nice! Now our bot is able to understand different types of sentences, and gives information to people about people around them based on what they like to do, whatever that is.

As we said before, the fact that we are talking about soccer is not important. What is important is that we are talking about something, whatever this thing is. The Machine Learning inside SAP Conversational AI allows us to give a few examples, and understand endless sentences, because what is important is not the word itself, but the construction of the sentence and the place of the word inside it.
Making this bot was given to me as an onboarding task at SAP Conversational AI, and it allowed me to understand what NLP and Machine Learning are, and even to get a foothole in the complexity of conversation management.

Ask your questions on SAP Answers or get started with SAP Conversational AI!

Follow us on