Open Editions

 View Only

How to consume IBM BAMOE decision microservices by IBM RPA bots?

By Raul Mariano posted Wed October 09, 2024 08:42 AM

  

After the last posts and getting feedback from community members, I felt the need to post new technical content, but with a slightly different approach than the previous ones. I prepared content that technically shows the integration of technologies on a study case – despite being a fictitious case, I was careful to put together a story from end to end, including making the files used available. I hope you can also replicate this case in your environment.

I will demonstrate how an IBM RPA bot can consume IBM BAMOE decision microservices. I must confess that I liked the result and am sure that combining these technologies can make a difference and further enhance the benefits of RPA projects.

The proposed case involves segmenting and registering customers in a web form. In short, the bot must execute the process in the following steps:

  1. Get all customers for processing from a CSV file.
  2. Send each customer's data to the decision microservice to obtain the score and segmentation
  3. Register the customer with the data in the WEB form

I'm making the files for this case study available on GitHub. Check them out:

  • data.csv – Spreadsheet with customer data to be segmented.
  • insertSegmentation.html – HTML form used by the bot to register the segmented customer.
  • IBMRPA_and_DMOE.wal – IBM RPA script with all the bot commands and interactions.
  • CustomerSegmentation.dmn – Decision diagram with all customer scoring and segmentation rules.

Thinking about business rules, I separated 4 rules that will define customer segmentation. Using numerical ranges, each rule will define a score based on the customer's purchase history. Where the nodes “recency_Score”, “ticket_Score”, “frequency_Score” and “customerScore” will define the customer's score, and the last node “customerSegment” will apply the segmentation.

Now, look at the rule defined on each node:

  • recency_Score: How many days ago did the customer make their last purchase? In other words, has it been a long time since they last purchased from the company?
    • If the customer purchased in the last 30 days, then 5 points are added.
    • If the customer purchased in the last 60 days, then 3 points are added.
    • If the customer purchased in the last 90 days, then 1 point is added.
    • If the customer has not purchased in the last 90 days, then they will not receive any points

  • ticket_Score: What is the average ticket for this customer?
    • If the average ticket is below $100.00, then the customer will receive no points.
    • If the average ticket is between $100.00 and $200.00, then 1 point is added.
    • If the average ticket is above $200.00, then 3 points are added.
  • frequency_Score: How often has this customer made purchases?
    • If the customer made fewer than 3 purchases in the period, then he will not receive a score.
    • If the customer made 4 to 8 purchases in the period, then 1 point is added.
    • If the customer made more than 9 purchases in the period, then 2 points are added.
  • customerScore: The sum of all previously calculated scores:
  • customerSegment: Finally, segmentation is done based on ranges:

In this article, I will not cover the steps to deploy the DMN. Check out the BAMOE documentation and the IBM community for more information.

Now that our decision microservice is published, let's go through the main IBM RPA commands.

  • “Read CSV File” command: Command opens the CSV file with the data that will be processed. If you are replicating in your environment, don’t forget to update the “File” field.
  • “Navigate” command: After opening the browser, this command informs the path of the Web form. Since this is an example and the HTML page is in a local directory, we use “file:///” at the beginning of the path.
  • Now that we have the CSV data and the web page is open, let's create a loop with the “For” command to repeat the next steps for all the rows found in the CSV.
  • The “Map Table Row” command will assign the row values ​​(i.e., for each customer) to variables that will be used later.
  • HTTP Request” command: This command communicates with the decision microservice. The main parameters of this command are Method, URL, Formatter, Body and Response, where:
    • In the “Body” we are passing a Json with the respective variable (mapped in the “Map Table Row” command).
    • As output, we will receive the Json in the “response” variable.
  • From this moment on, the “HTTP Request” command already has the return Json from the DMN.
  • “JSON to Table” command: is necessary to map the return Json, assigning it to the “tableResponse” variable.
  • In our case, the DMN will return only two new pieces of information: “customerScore” and “customerSegment”, for this reason, we use two “Get Cell Contents” commands to obtain the result of the decision.
  • Finally, we have the interaction commands with the web form to register the data obtained from the CSV and the decision microservice.
  • Finally, we can run the bot and validate the result of the automated process and rules.

Thank you for reading this! I would appreciate your feedback and feel free to suggest new topics for future posts.

As a bonus, I will leave a video demonstrating the solution in action. I hope it will help you understand the whole thing!
1 comment
43 views

Permalink

Comments

Wed October 09, 2024 09:45 AM

Good job ! Tanks