Sample by Frank Nimphius, February 2018
For bots to do anything useful, they need to integrate with data queried from remote systems. The most popular option for this is to query and write data through REST services and JSON payloads.
This sample explains how you populate a context variable defined in BotML with an array from a custom component. The variable then is referenced from a Common Response component (CRC, or CR component) to display a list of choices. The sample does not contain the REST connector call but starts from a JSON string representing an array of fruits.
Note that explaining ow to access REST services from custom components through connectors in Oracle Oracle Mobile Clou Enterprise is subject to a separate blog article here in TechExchange. This article focuses on how to pass data to the BotML so the CR component can render the structured information as not all data is a series of strings only.
At runtime, the sample bot displays the list of fruits for a user to select from (Figure 1). Notice that the list label is different from the selected value ("Yellow Banana" vs. "banana"). The CR component allows you to have labels that are different from the actual value set to a bot context variable (or multiple variables as you can save more than a single value from a list).
Oracle Intelligent Bots has been rebranded Oracle Digital Assistant to better describe its capabilities beyond a standard chatbot. To learn more, visit cloud.oracle.com/digital-assistant