The beauty of low code platforms is not just that you can build applications quickly but also you easily integrate platforms without any significant technical skills. In this post I am going to show how to call a Power Automate Flow using a Watson Assistant chatbot. I did a post a while back on how you can call a Power Automate Flow from a Power Virtual Agents bot to query details on an order record stored in Dataverse. This used a Power Automate Flow configured as a Http Request trigger that accepts a Json message with an order no. I am going to reuse that Power Automate Flow and call it from Watson instead of PVA. If you want some background on how to create a chat bot using Watson Assistant read my previous post here.
Step 1: Create An Intent
From the Watson designer the first thing I needed to do was to create an intent with the key phrases that will trigger my action.
Step 2: Adding Details To Power Automate Flow Endpoint
I then added details of my Power Automate Flow Http Endpoint under Options-> Webhooks. This Flow accepts an orderno value in a Json messages and returns details of the order in Json format from my order entity in Dataverse.
Step 3: Customize Node
I then added a node called “Get My Order using Flow” to my dialog to handle the #orderquery intent. I needed to use the customize option for the node to enabled Slots and Webhooks.
Step 4: Adding A Handler
Once slots is enabled I was able to add a handler to check if the user had entered an order no. The slot filling capabilities of Watson examine the user’s input and populates the @sys-number entity if it determines they have entered a number. The @sys-number value is saved to a variable called $orderno. Some more info on slot filling here. If the user has not entered an order no then they are are prompted to enter one. The variable is then passed to the webhook and the Power Automate Flow is called and the results are used to populate a variable called $order. The values returned can be displayed to the user by referencing using dot notation as follows $order.description. Watson has a nice concept of anything_else which I used to output a response if the $order variable is not populated.
Step 5: Web Chat Integration
Watson Assistant just like Power Virtual Agents makes it easy to embed your bot into your web site and other channels. From the integration option select the code snippet and copy it as required into your web site.
Step 6: Finishing & Testing Watson Chatbot To Call a Power Automate Flow
The Watson chatbot icon will appear on your web site and clicking the icon will open the chatbot window.
Hopefully this post shows how easy it is to integrate platforms from different vendors using low code platforms.