Introduction:
In this current blog, we will discuss about cloud integration monitoring and accessing of message processing logs (MPL). The MPL stores information about the individual processing steps for each processed message in the tenant therefore providing the detailed overview of every individual messages on the tenant.
To access MPL, we have got an OData API called “MessageProcessingLogs” which can be called to get details.
Now to call this API we have to do certain config in SAP BTP Cockpit and add required Roles in BTP to access MPL. We will deep dive into the config and design steps below.
Design/Development Steps:
Let’s break down the entire steps into simpler steps:
- Create Service Instance and Assign Roles in BTP Cockpit
- Develop Integration flow to call the API
- Design/ Develop SAP CAI Chatbot to access MPL and display details of message processing
Step 1. Create Service Instance and Assign Roles in BTP Cockpit:
To access MPL we need to create a service instance of SAP BTP service Process Integration Runtime with plan as API. To do that we need to navigate to SAP BTP Cockpit and then click on Services > Instances and Subscriptions under sub account used for Cloud Integration.
Now click on Create to proceed.
Granting required Role:
Once Service Instance is created we need to create Service Keys. And to do that, we need to go to instances created and choose the instance and clicking on the Actions( three dots after the name ) will open up a menu. Please choose Create Service Key there as shown below:
Once Key is created, we can utilize the clientid, clientsecrete and tokenurl to create Oauth Client Credentials in SAP Cloud Integration’s “Security Material” to authenticate the API access.
Step 2. Develop Integration flow to call the API:
- Step 2.1 : Integration Flow Overview:
Runtime Configuration:
Once the integration flow is deployed, we received an endpoint to call this integration flow. Now we will utilize this endpoint in SAP CAI chatbot and call this for MPL data.
Step 3. Design/ Develop SAP CAI Chatbot to access MPL and display details of message processing:
Logon to SAP CAI and create you chatbot.
Please follow these steps to create your bot:
- Click on “+New bot”.
- Select Perform Actions tile with no predefined skills.
- Enter a name for your bot something like getmpl.
- Choose “Type of data” as Non-personal and store conversation data as store.
- You can select the visibility of bot of your choice.
Now, your bot is created and ready to be configured.
- Create Intent:
Now, let’s create intent for the bot and to do that please navigate to Intents tab under Train and click on “+New Intent”. Please input a name for the intent and a description. Find below the created intent for the bot:
- Create Entity:
Now, let’s create an entity and to do that click on “+New Entity” in Entities tab under Train and name the entity as Messageprocessinglogs and choose the entity to be a Free entity because we want machine learning algorithm to detect all the possible values such as “status”, “logs” or “state” to help detect the actual status to the entity #Messageprocessinglogs.
P.S: SAP Conversational AI provides many predefined entities (gold entities) such as #location, #datetime, #number, etc. These keywords are already there to be used by the bot.
Now, we will highlight the keyword “status”, “logs” and “state” to match with the entity #Messageprocessinglogs and do this to all the expressions as below:
You can test if the correct intent is being executed based on the sentence you type.
On the right-hand side, click on the Expression Analysis console. A pop up window will open for testing.
Type some sentences there. If it’s correct, it should detect the keyword “status”, “logs” and “state” as the entity #Messageprocessinglogs and the status input will automatically be extracted.
- Add Skill to Chatbot:
On the build tab, create a new skill called ‘fetchmonitoringsuggestion’.
You can either choose skill type as Business or Floating because the technical purpose of both these skill type is same.
Now, click on the created skill add a firing condition of the skill means add a condition for which you want this skill to respond. To do that, go to the Triggers tab as shown add the condition:
Please have a look for other enough additional information prior to executing the action. Therefore, the value of status should exist.
Now, go the Requirements tab, to add the requirement.
If the status is complete, bot will send monitoring interval suggestions as quick reply and based on the user action Cloud Integration endpoint will be called to fetch the MPLs.
If status is missing, it will send a card informing user to ask about the status.
Now, after all the requirements met, we will now connect external services and consume the API we created in Cloud Integration. We have formatted the response to a list output and MPLs will come in a Item-Details list.
- Test Bot:
Now time to test bot:
If you want to see more details of the status sent, please click on any of the list item and that will take you to this screen below: