Skip to Content
Technical Articles
Author's profile photo Aman Tiwari

SAP Intelligent Robotic Process Automation | Fetching Unreleased Purchase Order through SAP IRPA & Conversational AI integrated chatbots Deployed on WebPage & Telegram

In this blog post, we will focus on how we can easily leverage the functionalities of Integrating SAP Intelligent RPA bot with SAP Conversational AI chatbot to implement some Business relevance use cases.

Introduction:

SAP Intelligent Robotic Process Automation : 

Automate repetitive manual processes by creating intelligent bots at the same time you can schedule, monitor and manage
your bots on cloud.

SAP Conversational AI :

An 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.

Use case:

An IRPA Bot that will dig into SAP system and will dynamically fetch all those purchase order which are pending for release and will send back to you.

Deployment Strategies:

  • Deployed on webpage for a web chat.
  • Deployed on Telegram.

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 Desktop 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.
  • Deploy our chatbot on Telegram and test it by communicating with it on Telegram.

SAP Intelligent RPA Bot Details :

First, we create our and IRPA Bot in Desktop Studio by capturing screens, creating workflows, generating scripts and defining context variables as per requirement and finally it should look like below :

Workflow :

Context variable:

 

Export the package of your project from Desktop Studio and import that same package in Cloud Factory.

Add that package in your Environment and create an API Trigger.

Select a package created and recently added by you in your environment..

Select trigger type as “API”.

Click on next then Provide trigger details like name and create it.

once trigger is created then in order to connect your API save these two info as follows :

  • POST URL :  Copy from Trigger information
  • API Keys    :  Copy from your Environment

SAP Conversation AI chatbots:

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

Click on “Perform Actions”:

Select predefined skills for your CAI bot.

Enter your Bot details and create it.

Select the options as done in below image:

Now, click on Create button for new intent and name it.

Provide intent name , description and click on create button.

Click on the newly created intent and an some expression for it.

Then click on the tab “Build” and add a customized skill or any standard skill (I took small-talk).

 

Click on the tab “Triggers” and add a condition.

Click on the tab Actions and define your conditions, Autoreply messages, any other service/action by bot:

click on “Connect to External service”.

Now, We will get Client Id, Client Secret, and Authorization URL for OAuth2 Authentication from Secret key created for our instance in the environment as mentioned in the below image.

Click on “1 key” link.

Set the value for ‘URL’ of the trigger in the API Service Configuration after POST and copy all details from previous step and paste it here.

In Headers tab, create a new field and put “irpa-api-key” in box below “content-type” and paste key that you copied from environment in box below “application/json” as key value.

Open Body Tab, fill it as filled below:

Now train your CAI bot and then we can trigger a job and test it.

Finally, we are good to go for adding a SAP CAI notifier.

In the Cloud factory, We will initialize SAP Conversational AI notifiers and it will be triggered when the bot has been executed successfully.

In order to add a notifier, we will be needing SAP CAI Client-ID , Secret-key , Authorization URL , Developer token.

To get above details, go back to CAI portal http://cai.tools.sap and in the chatbot configuration – click on the setting on the top right corner, under the “Token” tab go and copy the Client-ID , Secret-key , Authorization URL , Developer token.

Go back to Cloud Factory environment, select your trigger and click on add notifier.

Select CAI and click on next.

, Fill below details:

  • Choose notify on Success.
  • Put the copied Developer token in the field token.
  • Initialize the Conversation ID with ${invocation_context.conversationid}.

Fill details like Client-ID , Secret-key , Authorization URL , Developer token which you copied from previous step.

Finally, our CAI Bot is ready for its deployment in web page and Telegram.

Web page Deployment:

go back to CAI portal and open “connect” tab and select webchat and click on create button and then copy the webchat script.

Paste that script in your HTML page code within body tag.

Telegram Deployment:

For Telegram deployment, you need a token and you can get it by following steps:

Open the Telegram App on your mobile phone and search BotFather.

Start Chatting with BotFather by clicking START/ RESTART.

After Clicking START/ RESTART, click on /newbot.

Choose a name and a username for your bot, a username must end with ‘bot’ like testbot,
user31bot. It will give you a congratulation message that includes Token.

Post getting token, Go back to CAI portal and open connect tab and select Telegram.

A pop-up will come asking for a token, provide the token which you copied in previous step and click on update channel.

               

Finally your Bot is ready and deployed on Telegram and to access it, click on “t.me/bot name” link on the telegram that has come with a congratulation message, It will take you to the chat and Start Chatting Now !!!.

Congratulation, You have deployed your Integrated SAP IRPA & Conversational AI chatbot to both webpage and Telegram portal.

!! Enough Theory !!  Its time to watch now:

 

WEB Page  Deployment Video:

 

 

TELEGRAM  Deployment Video:

 

Reference links:

 

SAP Community call –  https://www.youtube.com/watch?v=T-eGePzq9ic

Conclusion :

 

Concluding this blog post, here we have seen that how exactly we can integrate SAP Intelligent RPA & SAP Conversational AI by defining parameters between them and set-up a connection. Also its deployment on multiple platforms like webpage supporting webchat and social platform like telegram.

Feel free to post a comment in case of any query or concern.

!!! Stay tuned for more, Happy Learning !!!.

Assigned tags

      9 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Harsh Verma
      Harsh Verma

      Too good man....

      Author's profile photo Paul PINARD
      Paul PINARD

      Thanks for sharing!

      Author's profile photo HCL Tech
      HCL Tech

      Thanks Paul.

      Author's profile photo Tanvi Nagpal
      Tanvi Nagpal

      Great!

      Author's profile photo HCL Tech
      HCL Tech

      Thanks Tanvi.

       

      Author's profile photo Kapil Pandey
      Kapil Pandey

      This is Brilient..!!

      Author's profile photo Raj Kumar Birru
      Raj Kumar Birru

      I have followed your tutorial instead of using Telegram I have connected my CAI chatbot to a web application, but I am getting the below error in iRPA - Notifier Logs:

      Please verify Client ID, Client Secret or Authentication URL. Failed to fetch OAuth token: 'Error while requesting access token: Error requesting technical user token with grant_type 'client_credentials': Error retrieving JWT token. Server URI https://sapcai-community.authentication.eu10.hana.ondemand.com/oauth/token. Status code 401. Response body {"error":"unauthorized","error_description":"Bad credentials"}

       

      I have tried adding "grant_type=client_credentials" at end of Auth URL. but still got the "401 UNAUTHORIZED" error in Notifier logs. You could see detailed issue and screenshots of all screens here.

       

      any help would be appreciated.

       

      Author's profile photo YING JUNG HSIEH
      YING JUNG HSIEH

      Hi Aman,
      thanks for your sharing!

      I followed your steps but I'm not sure where I lose or which step I did wrong... I get the error message:

      Error while processing request. Server response with an error {"status":403,"code":"SAP_IPA_12033","severity":"ERROR","message":"API Key was not provided in header or payload","correlationId":"1d91ef2a-c920-4fc0-5a77-565d22d426af"} and response headers [cache-control:"no-cache, no-store, max-age=0, must-revalidate", content-type:"application/json", date:"Wed, 25 Aug 2021 15:21:35 GMT", expires:"0", pragma:"no-cache", sap-passport:"2a54482a0300e600004952504100000000000000000000000000000000000000000000000000000000000039343832633839396538306134393462623134326431303861616433313530615245535443414c4c0000000000000000000000000000000000000000000000000000000000000000000b49525041000000000000000000000000000000000000000000000000000000003463643064326635333033313462643239626664663533353236316136323434202020002a7549ea0d899c48088228f80ae7042eff3433303239306438613562653431653700000001000000002a54482a", vary:"Accept-Encoding", x-content-type-options:"nosniff", x-frame-options:"DENY", x-request-id:"1d91ef2a-c920-4fc0-5a77-565d22d426af", x-vcap-request-id:"7be5403e-f8d2-4ce4-69f5-5f22c85d6c55", x-xss-protection:"1; mode=block", transfer-encoding:"chunked", strict-transport-security:"max-age=31536000; includeSubDomains; preload;"] and status code 403 FORBIDDEN

      I do add the API key in the Headers tab, and also add the suffix “/oauth/token” to the authorization URL, but the process still failed.

      Could you please help to check if there is anything wrong in following setting?

       

      Any advice and suggestions will be greatly appreciated.

      error message

      Author's profile photo YING JUNG HSIEH
      YING JUNG HSIEH

      I solved this problem today!

      I found it might be my iRPA agent version didn't match the SDK; therefore, I tried to update it to the latest version then I can post the request to iRPA.

      🙂