Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
sudipghosh
Active Contributor
Hello Everyone,

Welcome to my another interesting blog on recently released SAP Conversational AI new features "Consume API Service". In this blog i would try to discuss what is the benefit, how to use this feature, why chatbot integration just become super easier using this feature specially for ABAPer.

So what is Consume API Service ?



For example you are designing a chatbot  which will give you purchase requisition status from ECC or S/4HANA system then before "Consume API Service" we used to build a wrapper service based on node.js or python or java which as Webhook. And this wrapper normally we used to host either on SAP Cloud Platform Cloud Foundry or some other cloud provider like AWS, GCP. At the same time if some one is from ABAP background and dont know how to build wrapper using node.js or python is quite challenging to build such chatbot completely for him/her/others. But this Consume API service is just making everyone's job easy, don't need to build any wrapper direct calling odata can give you instant result.

After releasing this feature i am like 😛



So How is the Technical Architecture?



If you look at the Architecture, we don't node.js based Webhook application which normally runs on SAP Cloud Platform Cloud Foundry. I have used oData provisioning service because odata service need to be exposed into internet and my conversational AI is developer version which doesn't come as SAP Cloud Platform Service. if you are having productive SAP Conversational AI which comes as Cloud Platform Subscription then you can directly connect cloud connector, don't need any oData provisioning service.

What is the benefit?

You don't need to build any wrapper node.js, don't need to run any express Application or Python application which work as a Webhook. Direct integration with oData service.

How to use this Feature?

Let's discuss the main thing which we are waiting for. I am not going to discuss here how to build SAP oData service which will fetch purchase requisition status. Rather we will focus on how we can call the odata service directly.

Lets break this whole integration into small step.

 

Step 1: Exposing backend oData through cloud connector and oData provisioning service (Prerequisite)

As a prerequisite you need to setup your cloud connector and oData provisioning service for exposing your On Premise oData into internet.

 

Please have a look at the very informative blog for how you can expose your backend odata into internet through Cloud connector and oData provisioning service (Formarly Known as Gateway as Service)

Step 2: Analyzing Postman or oData response

So i have already exposed odata service which is exposed through cloud connector and oData provisioning service and below is my postman call response. (i have passed Accept : Application/json in header to get json Response and Authentication type is basic your SCP P/S/D/C/I username and Passowrd)

This odata service is very simple which return a status for a purchase requisition as you can see. Here i am passing purchase requisition number  as filter. Now if you look at the JSON response and if i want to access requisition status then its pretty easy which is d.results[0].ProcStat.

Step 3: Building Chatbot and use Consume API service feature

If you are very new to Chatbot development and still wondering how to build your first chatbot then look at this awesome tutorial

so in this case i have designed my intent and skill like below



And Skill is like below





So this pr variable is going to store purchase requisition number and which we will be using it as filter parameter in action of the skill. Now go to action and click on add new message group then click on connect external service -> Consume API service.



As it is GET call, select type as GET and use {{memory.pr.scalar}} as filter parameter. In Authentication use your SCP username and password



Now lets analyze the response of this API service.



This response part is non editable, and api_service_response variable is going to hold whole response from your odata. So this is how it looks like.
"api_service_response": {"default" : { "body":{odata response in json}}}

So if you want to access the purchase requisition status then below is how its look like                        {{api_service_response.default.body.d.results[0].ProcStat}}

so we just have to just add another text type send message below of this action to send purchase requisition status to user and then clear memory step like below.






 

Step 4: Test your chatbot

 



That's it, i hope you learned something cool, if you enjoyed this blog please like, share and comment.

 

Regards,

Sudip

 

 

 

 

 
49 Comments
Labels in this area