Skip to Content
Technical Articles

Connectivity of SAP Conversational AI bot with SAP FLP on SAP Cloud Platform

SAP Conversational AI

SAP Conversational AI can help you improve employee productivity, customer retention, and revenue by providing an end-to-end enterprise bot-building platform and a powerful digital assistant.

 

The bot builder gives you access to:

  • visual interface to design the flow, build the conversation logic and set up replies.
  • Webhook features to connect your bot to your own API or other services to fetch external data.

Intents

An intent is a set of expressions that mean the same thing but are constructed in different ways. Intents are central to your bot’s understanding. Each one of your intents represents an idea that your bot can understand. You can add as many intents to your bot as you wish.

Expressions

An expression is a sentence that your bot can understand – it’s basically something that a user might say to your bot. Expressions are organized into intents and constitute the entire knowledge of your bot. The more expressions you have, the more precisely your bot can understand its users.

Entities

An entity is a keyword that is extracted from an expression. Bot automatically detect 28 different entities such as Date-time, Location, Person, and so on. We call them gold entities. However, you’re not limited to these gold entities. You can also tag your own custom entities to detect keywords depending on your bot’s context.

Bot Builder

Bot Builder interacts with the other services of the platform.

The Bot Builder process is split into two distinct parts:

  • Get the user’s input through a messaging channel.

This can be done by the Bot Connector, meaning that when the Bot Connector receives a message, it dispatches the message to your Bot Builder. You can also collect the user’s input by your own way and send it to the Bot Builder API directly.

  • Understand the user’s input using natural language processing (NLP).

Once the Bot Builder receives an input, it posts the message to our NLP API to extract structured information from this sentence.

 

Skills

A skill is a block of conversation that has a clear purpose and that your bot 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 movie suggestions based on information provided by the user.

You can add a skill to your bot on the Build tab by clicking Create skill in the grey command panel on the left. You can add as many skills to your bot as you wish.

 

Skill type Description
Business Skills that are closely linked to the core purpose of your bot.
Floating    Small-talk skills, that is, topics that are not closely related to the core purpose of your bot.
Fallback Skill that is triggered if no other skill is triggered. Your bot can only have one fallback skill. So, when you add a skill to your bot, the skill type Fallback is offered only if your bot doesn’t already have a fallback skill.

 

Composition of a skill

A skill is made up of three distinct parts:

  1. Trigger: Triggers are conditions that determine whether the skill should be activated.
  2. Requirements: Requirements determine the information that the bot needs to retrieve from the user and how to retrieve it.
  3. Actions: Actions are performed by the bot (for example, send a message) when all requirements are complete.

Connect

In the “Connect” tab, you can configure the chat-bot to be embedded within other channels like Skype, Twitter etc.  For this demo, I am selecting Webchat as this needs to embedded within a web page.

 

Create a new Webchat configuration and select the color scheme, Header logo and title which you like to show within the SAP Fiori Launchpad.

 

When you click on “Create” button, this would provide you a webchat script. Copy this for use within the Shell plugin which would be created later. In particular, you would need the Channel ID and Token details.

Now its time to switch to your Cloud Platform Trial account. Launch “SAP WebIDE Full-Stack” service.

Enable the Extension of “SAP Fiori Launchpad Extensibility” and restart the IDE.

Create a new project based on a template

Select “SAP Fiori Launchpad Plugin”

Provide a project name

In the Template customization, provide the plugin ID and a Title. Since we don’t need sample code for header/footer, leave the check-boxes unchecked.

In the component.js file, add a line within the function init() to invoke the function renderRecastChatbot(). Below is the definition of renderRecastChatbot().

Note that the ChannelID and Token values are the ones copied earlier from SAP Conversational AI.

init: function () {
			var rendererPromise = this._getRenderer();
			this.renderRecastChatbot();
}
renderRecastChatbot: function () {
			if (!document.getElementById("cai-webchat")) {
				var s = document.createElement("script");
				s.setAttribute("id", "cai-webchat");
				s.setAttribute("src", "https://cdn.cai.tools.sap/webchat/webchat.js");
				document.body.appendChild(s);
			}
			s.setAttribute("channelId", "xxxxxx-Your Channel Id-xxxxxx");
			s.setAttribute("token", "xxxxx- Your Token -xxxxxxx");
		}

You don’t need to change any other file. You can deploy the application to your SAP Cloud Platform account after saving the changes.

The next step, is to prepare a Fiori Launchpad site. In the Fiori Configuration Cockpit, add a new app based on app type “Shell Plugin”. Below are the value which I provided based on my application.

Below is the configuration of my Shell plugin app

Property Value
App Type Shell Plugin
Shell Plugin Type Custom
Component URL /
SAPUI5 Component com.sap
HTML5 App name sapcaiplugins

Publish your site and test the Launchpad. You should be able to see the chatbot on the bottom right hand corner.

 

Section 1: Creating a  Simple Bot using SAP Conversational AI.

Blog Post: https://blogs.sap.com/2020/06/05/create-a-sample-bot-using-sap-conversational-ai-cai

I hope everyone enjoyed this blog, Please don’t forget to put comment and share 🙂

 

Regards

Nikhil Puri

 

 

2 Comments
You must be Logged on to comment or reply to a post.