Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos
Have you ever wanted to build your own chatbot? We made it super easy for you with our end-to-end platform. By following this tutorial, you’ll understand and master the different steps of bot-building with SAP Conversational AI, and you’ll have a concrete result at the end… ready to go live! Let’s start building!

What are we building?

We are building a bot that tells the weather, among other actions. To deliver these services, we need to enable our bot to do the following:

  1. Perform simple interactions like greetings and goodbyes

  2. Understand what the user is asking

  3. Answer with the appropriate action


1. To begin, create an account on the SAP Conversational AI platform. It’s free!

2. Once you’re logged in, it’s time to build your first chatbot. Click on the button “+ NEW BOT” in the header section, at the top right of the screen.

3. Choose “Perform actions” instead of “Retrieve answers” when you choose which chatbot you want to create.

4. You can choose one or more predefined skills for your bot. This will help you get started faster. Just select “Greetings” for now, but I encourage you to check out the others later.
Note: There will be a skill called “Weather” but for that, you have to create your own API. We don’t want that, so don’t choose that skill.

5. Enter a name for your bot: “weather-bot” would be appropriate.

6. Add a description.

7. You can select up to six topics to improve your bot training. Topics are keywords that can define your bot like “fashion”, “games” or “jobs”.

9. Set English as the default language.

8. Depending on how the data will be used, choose the appropriate Data Policy option.

10. You can keep your bot public since there’s no private info involved, but you can change this setting later.

You’re now ready to start building your bot! 🤖

The stages of bot building

There are four phases in the life of your bot. On our platform, these are represented by four tabs:

1. Train – Teach your bot what it needs to understand

2. Build – Create your conversation flows

3. Connect – Link your bot to one or several messaging platforms

4. Monitor – Get insights into the training and usage of your bot

Step 1: Create an intent to help your bot understand human language

This is the brain of your bot, where all its understanding is stored in the form of intents.

An intent is a collection of sentences that all have the same meaning, even though they can be worded very differently. When a user sends some text to your bot, our algorithm compares it to the phrases in your intents. Then it checks whether the text is close enough to one of them and decides what the intention of the message is.

Go to the “Train” tab, and create the intent “get-weather”.

Note: As SAP Conversational AI is a collaborative platform, you can also use the forking tool directly in the platform. You don’t have to recreate each intent every time you want to use it. You can fork an intent that someone has already created to clone it right into your bot. You just have to search for “weather” in the search bar!

Step 2: Entities

Entities are designed to extract key information from sentences that the user types into the chatbot.
For our weather bot, we don’t need to create a custom entity because the entity used in this case is the gold entity “location“, automatically detected in SAP Conversational AI.

For more information about gold entities, please read the SAP Conversational AI documentation.

Step 3: Expressions

Now that we have created our intent, we need to populate it with various expressions. An expression is a sentence added to an intent. A golden rule would be to add at least 30 expressions for each intent and ideally more than 50.

Click on your intent and add sentences you want your bot to understand. When adding expressions, put yourself in the shoes of the people talking to your bot. What could they possibly ask?

Note: Click the message “You have X expressions suggested to enrich your intent” to see examples of phrases you can add to your bot. This is a good way to speed up your training!

Step 4: Test your bot

Click the “TEST” icon near the top right of the screen. Type a sentence you haven’t used to train your bot – for example: “Weather in Berlin“.

You’ll see which intent was detected under “User is referring to”, and you will see the recognized entity under “In the expression there is”.
This means your bot knows that your user is asking for the weather and from which location. If the algorithm did not detect an intent or detected an invalid intent, you will need to train your bot with more expressions.

Go back to your intents and add or modify expressions. Then, test again. This might sound a bit repetitive, but it’s the best way to ensure your bot will detect users’ sentences correctly.

Once you’re happy with your bot’s intent detection, it’s time to move to the next phase: building your conversation flow.

Step 5: Build and manage the conversation flow

Now that you’ve filled the brain of your bot with the knowledge it needs, click the “Build” tab.

The “Build” tab is where you find the Bot Builder, which helps you construct the conversation flow of your bot using skills.

What is a skill?

  • skill is a block of conversation that has a clear purpose and that your chatbot can execute to achieve a goal.

  • It can be as simple as the ability to greet someone, but it can also be more complex, like giving the status of a delivery based on information provided by the end user.

  • You can add as many skills to your chatbot as you wish.

Composition of a skill

  • Readme: Where you explain the purpose of your skill

  • Triggers: Where you decide when the skill should be activated

  • Requirements: Where you specify which information this skill has to collect, and what questions the user needs to ask to fulfill the requirements

  • Actions: Where you define what to do once the requirements are fulfilled

Build your own skill

Go back to the “Build” tab and click on “+ Create skill” on the left side of the screen.

You have three different types of skills: business, floating, and fallback.

  • Business and floating have no structural differences. However, differentiating these two types helps when you have a lot of skills.

  • Fallback skills trigger when no other skill is triggered by the user’s input. Most of the time, you’ll have only one skill of this kind, where you can remind the user what your bot can do and ask them to rephrase.

Our skill will be of the floating type. Give it the name you want. I’ve chosen “get-weather“.

5.1 Trigger

Click your newly created skill, then go to the “Triggers” tab. We want to activate our skill when an expression contained in the “get-weather” intent is present.

5.2 Requirements

Next, go to the “Requirements” tab and create a first requirement.
Here, we’ll ask for some information that is necessary for the action to work properly. In our case, what we need is the location. Without it, of course, the bot can’t retrieve the weather.

Remember that when creating the entities and intents (parts 1, 2, and 3 of this tutorial), we used the location entity and some intents that might contain it.
The Requirements tab will extract the entity and save it to the bot’s memory.
Let’s create a requirement that asks the bot to save the recognized “#location” entity into a memory variable called “location“.

5.3 Action

Now that the condition is triggered and the requirements are fulfilled, the chatbot can now execute the action. First, we are going to post an API and get information from it.

Click on “Add new message group“, then “Connect external service” and “Consume API Service“.

Write the following URL in the field:

<<insert peronal key>&units=metric&q={{memory.location.raw}} >

You have to create your own key for the API to work.

Go to OpenWeather, sign up, and create a new key in API keys.

The key will take 10min to 2h to activate. Then insert your own key in the URL of the API.

If you try to use this URL normally it won’t work. If you want to try it, you have to replace {{memory.location.raw}} with a location and “insert personal key” with the key you’ve created.

  • memory: This is the way to enter the memory of the conversation (which we can access and modify whenever we want during the conversation)

  • location: This is the variable that contains the entity we are using

  • raw: This is the exact way the location was typed

We will be using different values of the API. For a better overview, you can download postman for free and paste the URL in there.

Next, we want the bot to give us a picture of the current weather.
Create a new message and select “image“. The image needs an URL. The URL calls up information on the API and changes base on it.

The URL is :{{}}@2x.png

If you want to find out what {{}} is, you can check the link of the API in Postman and go down to the weather.
We are going to use it to tell what the temperature is.

Create a new message and select “text message“. Since we want to get the temperature and the temperature is under “main” we have to write {{api service response.default.body.main.temp}} to get the temperature. It is given in degrees Celsius.

In the end, your message could look something like this:

< In {{memory.location.raw}} current temperature is {{api_service_response.default.body.main.temp}} degree celcius but it feels like {{api_service_response.default.body.main.feels_like}} degree celcius and the humidity is {{api_service_response.default.body.main.humidity}} %. >

In order to allow your chatbot to clear its memory between two questions, you can click on “Update conversation” and tick “Reset memory“.

Your “Action” tab should look like this:

To test if your skill is working, you can chat with your bot if you click on “Chat with your bot” in the right corner of the platform.

Deploy your weather chatbot on your website

Are you happy with your bot? Let’s deploy it outside of the platform!

Go to the “Connect” tab, click “Webchat”, and follow the instructions on the page.

In this easy step-by-step process, you’ll be able to do the following:

  • Choose the colors of the web client

  • Change the title and chatbot logo

  • Specify a welcome message, a user avatar, and so on

  • Enter a call-to-action text

  • Name your web client

The result will be a short Javascript code that you can copy/paste into the HTML code of your website.
You can also follow this tutorial for a complete step-by-step process.

And that’s it! Hope you’ve enjoyed building this chatbot, I’m sure it’ll help you the next time you’re unsure about the weather outside 🙂

For more information about SAP Conversational AI:

1 Comment
Labels in this area