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.
cancel
Showing results for 
Search instead for 
Did you mean: 
7,584

Introduction:


This blog post is created as a part of SAP Conversational AI Tutorial Challenge 2021. This tutorial describes about how to build chatbot and integrate with an application interface that is integrated with SAP Ariba. Our main objective is to provide a very easy way to know the status of SAP Purchase Order and also, confirm the order over a chatbot from various user channels like Facebook, MS Teams besides using the bot in the application interface.

 

Use-Case Description:


Application we are talking about was developed as a part of integrating with SAP Ariba to provide new look and feel, a fresh UI experience to the buyers and sellers who are the main actors of the application. As a part of the same requirement, we had performed a POC about integrating chatbot as well to add value to the application users about two use-cases:

  1. Knowing the status of the given SAP Purchase Order as a buyer.

  2. Confirming the status of the given SAP Purchase Order as a seller.


 

Technical Architecture:


SAP Ariba integrated UI interface application is built using SAPUI5 and Spring technologies. There are REST APIs developed as a part of the backend implementation and it supports fetching the status of the given SAP Purchase Order as well as confirming the status of SAP Purchase Order which creates an effect and keeps data synchronisation in both UI interface application and SAP Ariba.

Using the exposed REST APIs, a chatbot will be built to fetch the status of SAP Purchase Order as a buyer and confirm the SAP Purchase Order as a seller by providing various user channels with respect to chatbot usage.

 

Basics of SAP Conversational AI:


SAP Conversational AI has two main blocks: Bot UI assistant & Bot building platform.

In short, 'Bot UI assistant' is about providing various means for providing the UI to the user to interact and 'Bot building platform' is about the surface where various softwares interact in building an intelligent response to the user.

Every bot will have the following life cycle hooks (as well as 'tabs'):

  • Train - denotes recognising and understanding statements what users will give.

  • Build - denotes building the response to be shared back to the user.

  • Connect - denotes connecting the bot with various channels (i.e. Facebook, Skype etc.)

  • Monitor - denotes monitoring the bot and improving its performance based on its metrics.


TRAIN tab:


It is about making the bot recognise and understand statements given by users using NLP (Natural Language Processing) software. Please remember that users will give in input in various languages and at the same time, any matching statement given by the user should also be recognised.

  • Intents - denotes intentions of the bot.

  • Expressions - denotes various statements conveying the same meaning.

  • Entities (Gold & Custom) - denotes the noun (or) the subject about which the bot is being built. There are two types - Gold entities refer built-in entities like date-time, place, language etc. Custom entities refer entities built within the specific bot which make main subjects of the bot.

  • Custom Entities (Free, Restricted & Regex) - In custom entities, there are three ways of creation involved and all are group of entity values. The difference is that in Free entities, it allows new value even though not defined in the group, in Restricted entities, it is a fixed set of entity values and no new (or) similar value is allowed and in case of Regex entities, it allows set of values with the same pattern in all values.

  • Enrichments (Gold & Custom) - It is about attributes of every entity created. By default, there are three attributes - raw, value & confidence and in addition, there can be N number of custom attributes added. At the same time, a golden enrichment can also be added with its pre-defined  attribute values.


BUILD tab:


It is about building a skill that builds the right response to be shared back to the user.

  • Triggers - denotes on what basis, this skill should be triggered.

  • Requirements - denotes verifying whether primary & secondary inputs are met in the statement given by user.

  • Actions - denotes the place where actual response is formed by taking primary & secondary inputs and manipulating or interacting with external systems.


CONNECT tab:


It is about connecting bot built with various channels for user's usage.

  • User channels - denotes channels where the bot being built will be integrated and made available for user's usage.

  • Fallback channels - denotes alternative channels used to serve users during emergency or urgent priority situations.


MONITOR tab:


It is about monitoring and improving the performance of the bot.

  • Log Feed - denotes analysis of various sentences given by users.

  • Usage Metrics - denotes how every conversation, intent, skill, entity are used and performing.

  • Training Analytics - denotes capturing training analytics based on data sets.

  • Conversation Metrics - denotes a future option to be provided which is about analysing user's conversations.


 

Step-By-Step Implementation Guide:


#1 How do I create an account in SAP Conversational AI:


A minimum of name and email ID is required to create an account in SAP Conversational AI. It is very simple.


SAP Conversational AI home


 


Sign Up



#2 Create your Organisation & Team:


Organisation contains many teams and a team contains many team mates and this is purely organisation concept. Now, a team consisting contributors are created under a new organisation as follows:


Create an Organisation



Create a Team



Organisation and Team is created



#3 Creation of SAP Purchase Order bot:


Click on the button 'NEW BOT' and prompts the below page. There are two kind of bots that can be created - 'Perform Actions' and 'Retrieve Answers'. 'Perform Actions' kind of bots are used where there is a conversation involved and 'Retrieve Answers' will be used if there is a need to support FAQ documents.

While creating, there are options to select predefined skills, name and describe the bot along with topic it belongs to, data policy & its visibility.


SAP Purchase Order bot



#4 Creation of "Intents":


'fetchorder' intent is created and its main aim is about fetching the status of SAP Purchase orders. As mentioned in the screenshot, there are quite a lot of expressions trained and all are denoting the same meaning - i.e. knowing the status of the given SAP Purchase order.


fetchorder - intent is created


Similarly, 'confirmorder' intent is created and its goal is to confirm SAP Purchase Order based on the given order ID. As displayed in the screenshot, there are a few expressions trained and all are denoting the same meaning - i.e. confirming the given SAP Purchase Order.


confirmorder - intent is created



#5 Creation of "Entities":


A regex entity is created as the order ID will contain a pattern prefixed with 'PO' followed by three digits as suffix.


order-ref entity is created


In this example, there is no need for additional custom enrichment attributes and so, it is not created. After creation of entity 'order-ref' which is common to both intents 'confirmorder' and 'fetchorder', in all its relevant expressions, this entity is tagged against a key word called 'order' in all expressions as shown below:


confirmorder - entity is tagged



fetchorder - entity is tagged



#6 Building the "Skill":


A skill is about building the response by manipulating user's input and connecting to any external systems if required. There are three types of skills :

  • Business - denotes the purpose of the bot.

  • Floating - denotes partial or related to the purpose of the bot.

  • Fallback - denotes a skill as a fallback.


  • Triggering the skill:




In this example, this skill should be triggered when any one of the intents i.e. 'fetchorder' or 'confirmorder' is identified.


Triggering the skill





  • Verifying requirements:




Order ID is the main input being looked from the user's statements. There are two paths - if order ID is present, then take an action else, show a message mentioning order ID is missing.


Verifying requirements



Storing order in memory if order ID is present



Inform user about missing order ID





  • Action - Building the response:




As a response, any one of the following can be returned - text, image, carousel, quick replies, card, buttons, list, client data, custom. This response can be built by manipulating given inputs, connecting to external system, updating the conversation or connecting to a fallback mechanism. There are two ways of connecting to external system as follows:

  • Call web-hook - Used to consume service which returns response in SAP Conversational AI standard format and this is usually used in integrating wit SAP solutions.

  • Consume API service - Used to connect to any API service and reads the response as sent by the API service.


In this example, once order ID is identified and based on the given statement about fetching order status, 'fetchorder' intent will be identified, primary input will be evaluated and response as shown below will be built by validating the order. After building the response, 'order' variable is reset.


Building the response about fetching order status


Similarly, when statements about 'confirmorder' intent is given, then relevant intent will be identified, primary input will be evaluated, connectivity to external API service will be evaluated and confirmed, then the same message will be displayed to the user. After building the response, 'order' variable is reset.


Building the response about confirming an order



#7 Connecting to User via various user channels:


There are three user channels where this bot is integrated. First one is about 'webchat' integration where a script tag will be generated after giving required inputs and the same tag is copied in the UI file of the target application where 'greetings' skill being triggered is shown, getting the status of the order using Facebook and confirming an order using MS Teams. This is just for an example as all operations can be performed from all user channels.


webchat - showing greetings


 


Facebook - fetching order status


 


MS Teams - confirming an order (refer here)




Order is confirmed as shown in the API response

 


Conclusion:


I would like to specially thank:

Prabhanjan Kumar for developing the UI interface application integrated with SAP Ariba

Geetha Ranjani and Tejaswi Bitra for being contributors in the development of chatbot

Satish Babu Janardhanan for initiating this thought, encouraging and driving us into this commendable solution.

We hope that this blog post will be very useful for building a SAP Purchase Order related chatbot. Thank you for reading this blog post and kindly share with us about your feedbacks and comments on this use-case.
103 Comments
Thanks for the detailed blog on this. Appreciate it.
naresh02
Employee
Employee
Thanks for the precise information!!
fazal_ilahi
Advisor
Advisor
Quite detailed, informative and would help to build or plug a similar scenario for customer use case.
former_member666706
Discoverer
Interesting blog on chatbot. Thanks for the step by step explanation on this !!!
former_member374496
Participant
Nice blog and adequate information on chatbot to begin with..
jasbirsingh09
Discoverer
Good blog. Very well explained. Thanks
GeethaRanjani
Advisor
Advisor
Very nicely explained tutorial on SAP ChatBot creation. Would be helpful to all those looking out for getting started with such POCs for their usecases.
former_member83518
Discoverer

Very well explained. Great content with all proper steps, very easy to follow. Thanks a lot.

former_member733684
Discoverer
Very informative and detailed along with snapshots. Anyone can understand and begin with SAP ChatBot or similar apps..
radha_datta_dhok
Associate
Associate
Very nice blog and well explained. Thank you
former_member329608
Discoverer
Well put together blog. Good explanation provided. Will give it a go.
former_member733685
Discoverer
Its more Informative and well explained. Thanks!!
former_member51321
Associate
Associate
Different thought and it is well explained use case and technical details. Appreciated!
Looks good and nicely explained step by step.
former_member733689
Discoverer
Very informative and well explained.
shoban12
Advisor
Advisor
excellent Blog to start with SAP ChatBot, very detailed to follow, thank you.
0 Kudos
Thanks a lot! .. Sachin.
former_member733731
Discoverer
Very Informative and clearly explained step by step .Thank you
0 Kudos
Thanks a lot! .. Naresh.
suchendra_kumar
Product and Topic Expert
Product and Topic Expert
Thanks a lot for the info.
Thanks for the detailed blog..
0 Kudos
Thanks a lot! .. Fazal.
0 Kudos
Thanks a lot! .. Punitha.
0 Kudos
Thanks a lot! .. Pradeep.
0 Kudos
Thanks a lot! .. Jasbir.
0 Kudos
Thanks a lot! .. Geetha.
0 Kudos
Thanks a lot! .. Sanjay.
0 Kudos
Thanks a lot! .. Ayesha.
0 Kudos
Thanks a lot! .. Radha.
0 Kudos
Thanks a lot! .. Adhithya.
0 Kudos
Thanks a lot! .. Navaneetha.
0 Kudos
Thanks a lot! .. Surendren.
0 Kudos
Thanks a lot! .. Avijith.
0 Kudos
Thanks a lot! .. Vivek.
0 Kudos
Thanks a lot! .. Shoban!
0 Kudos
Thanks a lot! .. Tejaswi.
0 Kudos
Thanks a lot! .. Suchendra.
0 Kudos
Thanks a lot! .. Prabhanjan.
Good Work, All the best
0 Kudos
Thanks a lot! .. Malay.
former_member365583
Discoverer
Great article. Very well explained and interesting use cases. Thanks for sharing your knowledge with us.
0 Kudos
Thanks a lot! .. Tina.
former_member733776
Discoverer
Very informative and detailed. Liked the way, things have been collated. Thanks for sharing this.
0 Kudos
Thanks a lot! .. Sumit.
former_member92035
Discoverer
Great Article. Well done!
0 Kudos
Many thanks! .. Onkar
former_member733774
Discoverer
Very good article...Appreciate the efforts...All the best.
former_member733779
Discoverer
0 Kudos
Very informative blog with step by step explanations. Thanks for sharing the it!!
0 Kudos
Thanks a ton! .. Raji.
0 Kudos
Thanks a lot ! .. Tejander.