Skip to Content
Technical Articles
Author's profile photo Murali Shanmugham

Building a central Launchpad using SAP Launchpad Service – Integrating Chatbots using Shell Plugins

[Update 2021]: Note that this asset was created before our branding changes related to SAP technology were announced on January 2021. Note that SAP Cloud Platform Launchpad was renamed to SAP Launchpad service, and SAP Cloud Platform Portal was renamed to SAP Cloud Portal service

[Update 2022]: Please note that this blog was published prior to the re-branding related to SAP Build portfolio, which was announced at SAP TechEd 2022. SAP Launchpad service and SAP Work Zone come together under the SAP Build Work Zone brand, with two editions: standard edition (formerly SAP Launchpad service) and advanced edition (formerly SAP Work Zone). You can learn more in this announcement blog post: SAP Build Capabilities Explained | SAP TechEd | SAP News Center

 

In this blog post, I will show how you can integrate a chatbot within the central Fiori Launchpad. I am referring to another recent blog post by Soeren Holst where he has explained in detail how you can use Business Application Studio and extend the Fiori Launchpad – “Developing a Shell Plugin for SAP Fiori Launchpad on SAP Cloud Platform, Cloud Foundry environment with SAP Business Application Studio

 

Building a central Launchpad using SAP Launchpad service on SAP BTP

Part 1 – Getting Started

Part 2 – Understanding the options around developing HTML5 apps in Cloud Foundry

Part 3 – Developing HTML5 apps

Part 4 – Integrating HTML5 apps with the Central Fiori Launchpad

Part 5 – Integrating 3rd Party apps with the Central Fiori Launchpad

Part 6 – Integrating chatbots with the Central Fiori Launchpad

Part 7 – Integrating with remote content providers

Part 8 – Enabling Notifications

Part 9 – Transporting Launchpad sites using SAP Cloud Transport Management service

 

I have been using SAP Conversational AI to build chatbots. With the current situation, I see many organizations deploying chatbots to help their staff with instant responses to the most common questions when they get back to work. I had earlier published a blog post on this topic “Enabling the Return To Work initiative using SAP Conversational AI & Qualtrics” where I have explained how you can quickly build a FAQ based chatbot using a wizard based approach and integrate it into multiple channels like Slack, Teams etc.

Build you bots using SAP Conversational AI

You can follow some of the previous blog posts or even new tutorial to get started with building a FAQ bot.  For this demonstration, I have created a configuration for a Webchat in the “Connect” tab.

The Webchat script will provide you with important details like the channel ID, Token etc. Copy this section as it will be used in our shell plugin.

Use Business Application Studio to create a HTML5 app managed by SAP

The Shell plugins which we need to develop are simple HTML5 apps.Similar to the previous blog post, use Business Application Studio to create a new SAPUI5 based application using the templates. Make sure you select the option “Managed by SAP Cloud Platform”  for the HTML5 runtime.

You can use the below code snippet

		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");
			s.setAttribute("token", "XXXXXX");
        }, 

     _getRenderer: function(){
            var that = this,
            // @ts-ignore
            oDeferred = new jQuery.Deferred(),
            oRenderer;

            // @ts-ignore
            that._oShellContainer = jQuery.sap.getObject("sap.ushell.Container");
            if (!that._oShellContainer){
                oDeferred.reject(
                    "Illegal State");
                } else {
                    oRenderer = that._oShellContainer.getRenderer();
                    if (oRenderer){
                        oDeferred.resolve(oRenderer);
                    } else {
                        that._onRendererCreated = function(oEvent){
                            oRenderer = oEvent.getParameter("renderer");
                            if (oRenderer) {
                                oDeferred.resolve(oRenderer);
                            } else {
                                oDeferred.reject("Illegal State");
                            }
                        };
                        that._oShellContainer.attachRendererCreatedEvent(that._onRendererCreated);
                        }
                    }
                    return oDeferred.promise();
                    }   

 

The next step is to edit the manifest.json file. We need to identify this application as a component, add the CrossNavigation section and declare it as a plugin

I have provided the source code below for you to use

        "crossNavigation": {
			"inbounds": {
				"Shell-plugin": {
					"signature": {
						"parameters": {},
						"additionalParameters": "allowed"
					},
					"hideLauncher": true,
					"semanticObject": "Shell",
					"action": "plugin"
				}
			}
	    }
	},
    "sap.flp":{
        "type": "plugin"
    },

From the command, use “Build MTA” and deploy the mtar file which get generated.

Once the app is successfully deployed, you should see a new entry in your HTML5 Applications menu.

We can now integrate this HTML5 app (Shell plugin) with the Fiori Launchpad

 

Configure the Launchpad Site

Navigate to the Launchpad service and fetch the updated contents for the HTML5 apps

Add the Shell Plugin to your contents

Assign the Shell Plugin to a role. For simplicity, I have assigned it to the everyone role.

We are now ready to test the chatbot within the Central Fiori Launchpad. It will appear on the bottom righ hand corner as shown below.

You can click on it and start interacting with the bot and also navigate to apps which on the the Launchpad.

If you do have any issues while configuring the bot, please post a question in the relevant forum.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Javier Andres Caceres Moreno
      Javier Andres Caceres Moreno

      Excellent

      Author's profile photo Toan Nguyen
      Toan Nguyen

      Great work!

      Would it possible also to add this plugin to the other apps of the launchpad, meaning the Sales / Products apps we can see on your screenshot?

      Author's profile photo Constanza Dominguez Escobar
      Constanza Dominguez Escobar

      Great!

      Its not necessary. Even if you click in the Sales/Products apps, the chatbot remains accesible.

      Author's profile photo Toan Nguyen
      Toan Nguyen

      great, thank you!

      Author's profile photo Aisurya Puhan
      Aisurya Puhan

      Hi Murali,

      Thanks for the steps. I am getting error  while rendering the chatbot plugin in the FLP. Below is the error :-

      Error - 404 , Channel not found.

      Channel%20Error

      Channel Error

       

      I am using both enterprise version of BTP and SAP Conversational AI.

      Request your help here.

      Thanks in Advance,

      Regards,

      Aisurya Puhan

      Author's profile photo Omkar G
      Omkar G

      Hi Aisurya,

       

      Facing the same issue, where you able solve the issue?

       

      Thanks & Regards,

      Omkar G.

      Author's profile photo Lucas Andrade Melchiori
      Lucas Andrade Melchiori

      is it possible to restrict the plugin inside a specific Fiori application?

       

      As it is built it would interfere with applications not meant to have the chatbot