Technical Articles
CAI – SAP Chat Bot
Background
I’m sure all of us have heard about Chatbot’s. Chatbot is one of the most popular emerging Tech trend. Chatbot can used for small conversation, it has the capability to enhance user experience and speed up any business process.
Typically, if I need to get any Order status, I will have to login into SAP to get details and if user is not well versed with SAP, he/she will have to call customer service desk to help them. This usually takes time. With Chat Bots this can be achieved with couple of clicks and data will be available readily for the user.
SAP use CAI (Conversational AI) for development of Chat Bots. It is easy to develop a chat bot. In below example, I tried to create a chat bot and fetch data from Northwind (https://services.odata.org/V2/Northwind/Northwind.svc/) services.
I have tried fetching data using API Key & SAP Odata (exposed Via ODP) and it is able to fetch data. So below is an small example for the same.
In below example, using Odata.org I will be trying to get data with respect to any Order, which user enters
Below steps will help us to create a basic chatbot.
Steps
Login into https://cai.tools.sap/ create your account
Step 1 – Click on “New Bot” – Provide Basic Details
Step 2 – First we need to define “Intent” – Intent is like user expression, which will help bot to identify what user is saying – Intents can be – Provide Order Details, Get Order Details etc. More value we define in intent, better bot response will be to understand user input
I have defined an Intent with few expression
Whenever user uses any of these intents a “Skill” will be triggered.
Step3: – Create a New skill – Inside Skill in “Triggers”, we can provide what shall be the trigger
The skill will trigger only if user has used one of the intent/expression, which we have defined above.
Step 4:- Now we need user to enter PO Number, That can be defined as part of requirement. Only if requirement is fulfilled certain Action will happen.
Click on “Arrow” & Click on Edit Replies
Once user Enter Order Number – Action takes place.
Going back to requirement – What ever user enters will be stored in memory.number.scalar
In Actions we can configure Odata and pass the variable to get the odata response
As we are using Odata.org, no authentication is needed.
If you use SAP OData exposed in ODP you need to pass your credentials
If you use API – You need to pass API Key
In Header Section pass – “Accept” “application/json”. This is mandatory for data to come.
Response will be storing the Odata response. We have to define Value in which it needs to be stored
Odata response will be stored as – {{api_service_response.Value.body.value[0] }}
Following the same steps, you can give options to user to select “What details” he/she wants
And based on O-data response we can pass it back/show to the user
Let’s see it in action
Conclusion:
Chatbots are here to stay. 🙂 They are still emerging, can enhance user experience and as fancy as they sound “Being ABAPer”, we can still work develop it. 🙂
Cheers
Hi Ashutosh,
I appreciate you for writing a simple blog to create chatbot application.
I followed your blog for creating chatbot app, once I enter order id I am not getting any response.
I have configured as below
after this what action I need to perform to get response from bot
In your blog I have read, if we use API service we need to follow below steps, can you please help me how to move further from here
Thanks In Advance
I am seeing, the following.
check camelCase you use "value" and print "Value"
Regards
Hi Ashutosh,
thanks for your post.
I'm having some issues with the call to the Northwind service, I already configured all as explained in the blog, but I'm having problems when input the document number:
I'm having this message in debugg:
and I'm using the same url as the sample: https://services.odata.org/Northwind/Northwind.svc/Orders/?$filter=OrderID eq {{memory.number.scalar}}
I can not get where is the error.
Thanks in advance.
A.