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: 
sabarna17
Contributor


Intro


SAP iRPA & SAP CAI are the two prime topics that are changing the game in this rapid and volatile Enterprise Plannings and Product Designing approach. SAP already has proven that no-code/low-code can be a very useful and easy way to design modern AI-Bot driven Enterprise Softwares.

This blog will give an overview of the integration aspects of iRPA and CAI bot with Node-Red.

Node-Red is a flow-based development tool for visual programming originally developed by IBM. This was originally developed to configure hardware to develop IoT-specific scenarios. This also has a huge potential to develop UI / Backend / Business Process Automations / IoT / Machine Learning / Block-Chain.

Create your first node-red flow here: first-flow-Node-Red

This makes it ideal to run at the edge of the network on low-cost hardware such as the Raspberry Pi as well as in the cloud. If you want to deploy this in SAP BTP Cloud Foundry Environment, check this one - Node-Red in SAP Cloud Foundry

 

What you will get here?


Easy API development is one of the prime motives to use Node-Red. SAP iRPA notifiers and CAI integration is the major aspect which is being covered here.

How this blog will benefit your application design and help to create an agile framework to implement your business logic -

  • MS Teams integrations with iRPA bot Notifiers

  • If an iRPA bot takes 2, 3 hours of time to execute, then directly then the CAI Chat conversation might not be updated from the iRPA notifiers. To do that we need custom logic to be implemented

  • If More complex logic is to be implemented in iRPA trigger / Notifier, then using a Node-Red wrapper will ease up the calls of the APIs and along with the Business Logics.



Prerequisite:



  1. Basic understanding of Node-RED

  2. SAP BTP basics

  3. SAP iRPA and CAI basics


 

SAP iRPA Notifiers(Scenario Explanation):


The requirement here is to embed multiplier notifiers into one iRPA Notifier. We can create multiple notifiers for a Bot execution. But maintaining multiple notifiers for several bots will consume more time and effort to monitor and check the bot executions and notifying channels. Here are the brief points which are covered

  • If the iRPA bot is triggered from a Chatbot then respond back to the CAI bot

  • If the RPA bot execution is a success then send an email to a respective person whose email id will be maintained in a custom table

  • As well as notify a Microsoft Teams channel about the execution of the iRPA bot


Developing such a scenario with iRPA notifier itself might take some time. As well as we could have used node-JS / python-powered APIs as well. But choosing Node-Red here will give a quick feasibility check and give a quick resolution to the requirement.

The major reason to use Node-red is, this Notifier logic has to be implemented for an entire Functional module related iRPA bots.

Know more about iRPA notifier and Triggers: SAP iRPA Notifiers

Here is the pictorial representation of the summary of requirement:


Node-Red design to collab all three requirements into one API. This API can be configured in iRPA Bot Notifier.

Note - This Single Node-Red API can be consumed for each iRPA bot execution Notifier



 

Step 0: Create bots - iRPA & CAI


A. Create a Sample iRPA Bot in SAP Cloud Studio / Desktop Studio.

B. Deploy your iRPA bot in the Cloud factory.

C. Create a CAI bot and implement a skill. 

D. Create an API trigger in the CAI-skill to call the iRPA bot.

 

Step 1:


Create a Power automate flow for the MS Teams Chat injection to an MS Teams Channel. This power automate flow has a trigger with an HTTP request. And the Teams channel connectors have to be configured.



Step 2:


Create a flow in Node-Red as below and configure the HTTP-endpoint as created in step1.


teams-flow



Step 3:


The next step is to notify the CAI bot back about the status of the iRPA bot. Configure the flow as below:


fig - flow for CAI endpoint


Code for "Set CAI Dialog API":
msg.headers = {};
msg.newurl = '';
msg.newurl =
'https://api.cai.tools.sap/connect/v1/conversations/' +
msg.payload.invocationContext.conversationId +
'/messages';
msg.headers['Authorization'] = 'Token ' + '{{CAI_TOKEN}}';
msg.headers['conid'] = msg.payload.invocationContext.conversationId ;
msg.headers['Accept'] = 'application/json';
msg.headers['Content-Type'] = 'application/json';
if(msg.payload.status === "success"){
msg.payload.messages=[{ "type": "text", "content":"iRPA Bot EXECUTED"}];
}
else if(msg.payload.status === "failed"){
msg.payload.messages=[{ "type": "text", "content":"iRPA bot failed to execute"}];
}
else{
msg.payload.messages=[{ "type": "text", "content":"iRPA bot running"}];
}
return msg;

 

Then in node "Set CAI Dialog URL", set the value of the URL as ->
msg.url = msg.newurl;

 

Step 4:


The last section is sending an email. Add a new node(node-red-node-email) from the Manage palette. Then configure the email node to send an email notification.


email-endpoint-config


Step 5: Deploy your Node-Red in the SAP cloud BTP environment. 

Follow the blog - https://blogs.sap.com/2020/09/29/all-about-node-red-deployment-in-sap-cloud-foundry/# and create a Node-Red environment in SAP BTP. Then set up the API there

 

Step 6: Configure this node-Red API as "iRPA bot API Notifier"


Reference and Must Read:




Conclusion


Hope you are able to understand the scopes of the iRPA and CAI integration aspects via the Node-RED wrapper. As Node-Red can be deployed in the SAP BTP environment, it gives a huge area of security and logic modifications as well. It might ease up the coding and software design aspects of your SAP life.

Thanks for reading. And feel free to opine.


 

 
Labels in this area