Conversing with IBM Business Automation
Hickmat 100000QA3T Visits (326)
Over the last few weeks I have been looking at how I could integrate a Watson Assistant powe
In one of my other "experiments" I have implemented an approach around a "postbox" and "messages" to a user which can be in the form information and a level of actionable messages e.g. collect more data. Using this approach the overall flow I wanted to achieve looked like:
Using the work I had done previously to API enable a Watson Assistant powered virtual agent [see Weat
Not being an expert with IBM Business Automaton Workflow I had one of my colleagues spin up a process for me where a potential route through the process would trigger the need to complete a "Task". At this point the process would call and API to create the message to the user. The created process flow ended up as follows:
In the above flow, its the "Conv Request" path which invokes the API call to create the message. As mentioned above the key thing is to have the message convey the "information capt
In the above the key element is "add
This flow is triggered from a button rendered as part of managing the displaying of the message from the postbox (If I get chance this is another blog post) and it drives a specific question string back into Watson Assistant to hit the "col
The next dialog node simply checks if the user is happy to provide the details that are required. Assuming they agree then we flow on to the "Ask or Information" node.
This node pulls out the data to collect on this iteration (based on the itemNumber context variable) and uses the description provided in the JSON passed from the Process to prompt the user to provide the necessary information. To perform the actual "capture" of the information I use the "Type" information passed in the JSON.
In the above you can see that I am using the "type" information in "itemInformation" to determine with dialog node should be used. Where I have a way to detect the entered data as a particular type I use a slot to capture the data otherwise the "Get Other" node just captures what ever the user enters. The following shows how I use the sys_number system entity to capture an integer
Using this approach I have been able to extend the type checking to other data elements like "postcode" as shown below
Once I have captured some data I need to store it so I can ultimately build the response back to process to allow it to progress. This is handled by the "Get Collected Value" node
In this node I build up an object which holds the captured value and the "name" of the variable which requires this information. Once this has been completed I then move on to the "Store Input" node.
In this node I add the collected data to an array and in this way I can collect all the items of information which the process has requested. Once the data has been stored I jump back to check if there is more information to ask for. After all the formation has been collected (itemNumber = the numberOfItems) I make an API call back to the process. The details about the process instance are included in the data passed via the message and form part of the conversation context. I use my "callapi" approach to make the call back to the process.
With that in place I could successfully initiate a process and have it prompt for data which I could collect and pass back to the process. The only issue was how to let the user know that there is a requirement to provide more information. The "Postbox" solution I had created would prompt the user at the start of a conversation that new messages exist but if the conversation was in flight they would be un aware unless they explicitly asked if there were any new messages. To fix this I turned to the Watson IoT platform (and as any regular readers will know - a regular play ground for me). Using Watson IoT and the WebSocket MQTT library I plugged a simple notification flow into my WebUI causing an alert message box to be displayed when a message has been posted to the postbox. This worked a treat allowing the user to be kept fully up to date. The following shows the over all architecture I put in place to build this MVP.
The following shows a run through of this scenario showing the starting of the process, that process asking for more information and finally the process updating the user as to the outcome of the process.