Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
In this blog post, we will learn how to capture any plain text input from the user for which values are not defined in the entity.

This blog post is 2nd part of a series with the following parts:


So let's get started!

We will follow the following steps:

  1. Add the requirement in our skill.

  2. Configure the fallback skill.

  3. Update the reply from chatbot.

In part 1, we created a free entity "message", which can be used to store the message(any random text e.g. Happy birthday John), to be written on the cake.


Step 1. Add the requirement "message" in the skill.

After adding the requirement, we have to tell the chatbot how to handle a scenario when any of these inputs are not given by the user. For that, we define a reply which chatbot sends to the user in case a particular requirement is missing.

To achieve this, click on the Chevron of the Message row:

You will see two options.

  1. If #message is complete.

  2. If #message is missing.

Click on the +New reply on if #message is missing.

Select send message and select text message. Add a message of your choice.

After adding the message, we will now set a field in memory, basically a boolean flag so that chatbot knows we are trying to enter a message for cake.

We are doing this because if we enter any random input in the chatbot for which an intent is not defined, then the fallback skill is triggered. And since we do not know what message a user might want to get on the cake, we do not have a scope for the message entity. Hence we set a flag when the user is asked to enter the message for cake and check the value of this flag in the fallback skill.

So we set the following value for a variable cake_message_set.

The reply will finally look like this:


Step 2: Configure the fallback skill.


Open the fallback skill and navigate to the Actions tab.

Here, we will add a new message group.

This message group will get triggered when the cake_message_set flag is set to true.
If  _memory.cake_message_set.flag  is  true

We can now take the text entered by the user as the message to be written on the cake and set it in the memory. We then unset the cake_message_set flag.

To do this, click the button Update Conversation, from the drop-down, select Edit Memory.

The following fragment appears:

In the Set memory field section, enter the memory key as message with the following value:
"value": "{{current_message.content}}",
"raw": "{{current_message.content}}",
"confidence": 0.99

Then, in the Unset memory field section, enter the memory key as cake_message_set.

After this, we need to again trigger the main skill i.e. process-cake-order. For that, click on update conversation inside the same message group of fallback skill and click goto.

Then select the skill process-cake-order and press save.

The message group should now look like this:


Step 3: Update the cake-bot reply.


Let us now update the reply given by the bot to show the details of the message on the cake too.
Here are your order details: 
Flavor: {{memory.flavor.value}}
Weight: {{memory.weight.value}}
Message on the cake: {{memory.message.value}}



Our bot is now ready. Let us test the bot.

Click on the button Chat with you bot on the bottom right corner.


Perfect! The bot is behaving as expected.

In Part 3 of this series of blog posts, we will learn how to connect the cake-bot to a backend service, where the orders can be processed.

See you in part 3.


Happy bot building! ?