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: 
thanu_sk0394_5
Explorer
Hello There,

In this blog post, I want to explain how developers can easily leverage the functionalities for Integrating SAP Intelligent Robotic Process Automation 2.0 bot with SAP Conversational AI. Here, we are getting Grand Total from Invoice by searching for Order-Id which is requested by a user in SAP CAI chatbot, and integrating the searching of PDF Documents using SAP IRPA by API Triggers and CAI Notifiers.

Introduction:


SAP Intelligent Robotic Process Automation – The process of automating the workflows with the help of robots/software to reduce the involvement of humans. This can be achieved by creating intelligent bots that you can schedule, monitor, and manage on the cloud.

SAP Conversational AI – A programmatic and intelligent way of offering a conversational experience to mimic conversations with real people, through digital and telecommunication technologies. Here we can build, train, connect and monitor chatbots.

For this development, the following are the prerequisites:

  • SAP CAI Bot

  • SAP Intelligent RPA 2.0 Bot

    • API trigger and notifiers in SAP Intelligent RPA





  • Client ID and Secret – To setup Integration

  • Cloud studio – Installed on your machine

  • Desktop Agent – Installed on your machine


The main steps involved in developing this are as follows,

  • We create a project using Cloud studio

  • We deploy, add API trigger, and CAI Notifiers.

  • We create a chatbot using Conversational AI

  • Setup Integration of Intelligent Robotic Process Automation and Conversational AI bots

  • Setup Connect SAP Conversational AI Web Client

  • Test our project by communicating with our custom chatbot.


SAP Intelligent RPA Bot Details:


First, we create a project in Cloud Studio and in that create automation, add the respective Dependencies from Settings and the final automation will look as below image. More details on this automation will be in this link PDF_DATA_EXTRACTION.


The input and output parameters for the above-mentioned automation are as below.


After the successful deployment of the SAP Intelligent RPA 2.0 Bot, create an API Trigger and copy the URL and irpa-trigger-token from the fields shown in the below image. Use the copy button to copy the data into a text file. You will need it in the chatbot configuration.


The key things to be noted from the API Trigger are “URL” and the contents of the “Payload sample”. Also, the API key is created in the instance for an environment to be copied.



Working Overview of Chatbot:


To identify the request for “Grand Total” in a PDF file by searching for “Order Id” a “Intent” is created called “@grand_total” which consists of 24 statements by which “Grand Total” can be requested and to identify the “Order Id” a new “Entity” is created as “#ORDER-ID” which is of “REGEX” type, for this use case the Order-Id consists of two characters at the start followed by eighteen numbers so expression is set as “/[A-Z]{2}[0-9]{18}/” with case insensitive selected.

The “#ORDER-ID” Entity is defined in “@grand_total” Intent using various combinations of “Order-Id” then a new skill is created as “grand_total” and in the triggers of this skill, the conditions are defined if Intent “@grand_total” is present and Entity “#ORDER-ID” is present or if Entity “#ORDER-ID” is present this skill should get triggered. In the Requirements Entity “#ORDER-ID” is stored in the memory as “OrderId”.

In the Actions tab first, a message is shown saying that “Getting your total for {{memory.OrderId.raw}}” in which “{{memory.OrderId.raw}}” returns the Order-Id given by the user and then an API Service is consumed for calling the SAP Intelligent RPA bot trigger to run automation when the automation is started by the bot a message is sent saying “Intelligent RPA Bot is searching for your Order Id” then on successful execution of Bot process if Order-Id was found in the PDF file it returns the “Grand Total” else it returns a message saying “Order Id could not be found”.

If the user gives any other number as Input for “Order-Id” then “Validate Order-Id” of type floating which is expecting “#number” as trigger gives a reply saying, “Please provide Order Id to get your Grand Total”. And Fallback Message is given as “Would you like to get Total for an Order Id” with buttons Yes/No, if Yes is pressed “validate-order-id” is triggered if No is pressed a message is displayed saying, “Thanks for your time please come back again for more services.”

Chatbot Creation


Login to the cai.tools.sap and go to the home page click on the new bot.


Click on “Perform Actions”:


Once you click on to perform actions tab, you will reach this page :


Now we have to make some selections :

  • We can choose “Greetings” from the Predefined skills for the bot.

  • Fill in the name of your SAP Conversational AI, for the creation of the bot.

  • From the data policy section Choose Non-personal, Store and Non-vulnerable as options

  • For the bot visibility section, we can choose Public.

  • Then click CREATE A BOT.


Now, click on Create button for new intent and name it. For my chatbot, I have deleted the intents goodbye and greetings and created a new intent called grand_total.


 

Click on the intent grand_total and you can add expressions like this :


Then click on the tab “Build” and add skill


Once we click on Add, the skill “grand_total” is created.



Click on the link inside the skill which is called “grand_total” we see this screen.


Click on the tab trigger and add a condition.


Click on the tab requirements. Here I have entered #order-id as OrderId.


Click on the tab actions, then click on “Connect External Service” then choose “Consume API Service”.


Set the value for ‘URL’ of the trigger in the API Service Configuration after POST.


Now, enter the tab authentication and select OAuth2 Authentication, the Client Id, Client Secret, and Authorization URL.


We will get this information in the Secret key created for our instance in the environment as mentioned in the above image.


For Access Token URL: we need to copy this from the URL property in the service key. we will find the URL property under uaa.

Don’t forget to add the suffix “/oauth/token” to this URL to form the Access Token URL:

The value of irpa-api-key is the API key of your environment and the value for Authorization is the access token url.


Then fill in the contains of the body.


Now we can trigger a job and check if that the job is a success in the factory.



Finally, we can add SAP Conversational AI Notifier.


In the Cloud factory, we must add at least one SAP Conversational AI notifiers on your API trigger. Here, I have initialized an SAP Conversational AI notifiers, it will be triggered when the bot has been executed successfully.


Earlier doing this we have to retrieve the token for our chatbot. To do this in the chatbot configuration click on the setting on the top right, under the Token tab go and copy the Developer token.


On our environment of the factory click on add Notifier of the trigger. Select CAI, click on Next

For the SAP Conversational AI Notifier

  • Choose Success.

  • Put the copied Developer token in the field token.

  • Initialize the Conversation ID with ${invocation_context.conversationid}





  1. In the message content put as follows:



We can test the SAP Conversational AI notifiers from a web page to make the contents of the web page visible in the chatbot. In the tab connect of the chatbot configuration, click on create.


Copy the information of the web client script in an editor text, save with extension Html.


When we have launched this page in a browser we will see this result.



The Video Link for the Showcase:




 

Conclusion


Concluding the blog, here we have seen that how exactly we can integrate SAP Intelligent Robotic Process Automation and SAP Conversational AI. We can integrate any irpa bot with conversational AI to get the optimum results in the best and fast way with very few steps.

This automation will benefit the roles of business Process Lead, Business Process Analyst, Business Process SME, Process Executioner.

As part of the SAP Community, Do participate in the SAP Intelligent RPA Tutorials Challenge 2021 (reference link: SAP IRPA Tutorials Challenge 2021) to share more and learn more!

I hope you found this tutorial helpful. Please provide feedback in the comment section and feel free to ask any questions in the SAP Intelligent RPA Q&A area (link for reference: https://answers.sap.com/tags/73554900100800002142).

Meanwhile, you face any difficulties in implementing the above process steps, you can leave your comments or queries in this blog post, will try my best to respond at the earliest.

 
9 Comments
Labels in this area