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: 
Welcome to the 4th and the final blog post in the series. Kudos to you, if you have made it this far.

In this blog, we will extend the chatbot to handle the C4C-ticket-creation-conversation and finally, we will also see how easy it is to embed our chatbot into our Commerce Cloud B2C store or any website, for that matter.


Create C4C Ticket


Depending on the shipping status, the end user might be presented with a possibility of having a service ticket created for the delayed order shipment. We will start by creating an intent and a skill for the ticket creation part in the conversation.

Next, we will create a C4C API POST request with the order number in the body. You can pass other data as well depending on the API spec.


4.1 C4CTicket Creation API Call

We can then go back to our order status skill and ask for the end-user’s permission to create the ticket as part of the status conversation flow.

4.2 Chatbot Conversation for Ticket Creation


Once the ticket has been created, the ticket number could be given to the end user for reference.

4.3 Return the Ticket Number Retrieved from the API response


Entity Fetch Via Service API


We have seen creation of entities in a previous blog where we entered the possible expressions manually. The SAP Conversational AI platform also offers the possibility to fetch the entity values from a backend system using API calls. For our scenario, let’s suppose we need an entity that corresponds to names of all the products in our B2C Commerce Store. To create this entity, we will go to the Train tab and then the Entities tab and create an entity ProductName. Once created, we will navigate to the entity and under the list of values we will select FETCH VIA SERVICE API.

In the popup, you can enter the API URL along with the authentication details. Once done, click on the button Fetch. The 200-response code confirms the success of the API call.


4.4 Remote entity values fetching

In the next step, we are going to pick the attribute that holds product names, from the API response. As for the import option, Replace would overwrite the previous values in the list, if any while the Merge option would append the expression value list.

4.5 Entity Value List Populated from the API Response


Upon clicking the Import button, we can see the list of values getting populated. We now create a Skill that would trigger an action depending on whether a specific product name was entered inside the chat.

4.6 ProductName Entity Value List


Embedding Chatbot in the Commerce Cloud Site


The final step is to embed our chatbot into the commerce cloud B2C store and this could be achieved with minimal effort. On the SAP Conversational AI platform, go to the Connect tab for your chatbot and under Users channels select Webchat.

In the Webchat dialog window, navigate to Global settings, enter and name for your channel and click Create.


4.7 Connect Tab and User Channels - SAP Conversational AI


4.8 Webchat Script for Embedding the Chatbot inside a website

This will generate a script for the chatbot with a unique token. Copy the script and save it in a text file.

Save changes to close the dialog window. On the commerce cloud side, you can create a custom AddOn. The front-end items like JSP files, images etc. are stored in the acceleratoraddon folder for an AddOn. Update the addon’s JSP page with the copied script and install/configure the AddOn for your storefront.

Alright then, let's keep the last part short and sweet!

This concludes the blog series. I hope you will enjoy developing the end-to-end scenario as much as I did. Have fun and do let me know your thoughts in the comments. See you in another blog post!


Part 1: Introduction and Getting Started

Part 2: Building the SAP Conversational AI Chatbot

Part 3: Building the Qualtrics Survey and App



For more information about SAP Conversational AI: