About Bot Custom Components
As Figure 1 illustrates, a custom component service in Oracle Intelligent Bots is a Node.js-based REST service that hosts one or many custom components and that exposes two HTTP methods: GET and POST.
The GET method is invoked at design time by the bot when the custom component is registered with the Oracle Intelligent Bots instance. The POST method is invoked at runtime when the dialog flow navigates to a state that is associated with a custom component hosted by the component REST service.
metadata. This function returns information about the custom component upon custom component service registration in the bot. The information includes the component name, the definition of the component input parameters (properties), and the action strings returned by the component to enable the bot designer to decide how to continue the dialog flow.
invoke. This function is called at runtime and executes the custom component business logic. The logic may access dependent resources such as Oracle Mobile Cloud connectors, platform services, and custom APIs.
The custom component SDK consists of four files and provides functions for reading the incoming bot message and sending a component response:
Shell. The shell.js file contains the dispatcher logic that reads file locations from the registry.js file and loads the requested custom component implementation.
SDK. The sdk.js file is passed as a reference to the custom component’s invoke function.
MessageModel. The MessageModel.js file contains helper functions for the Oracle Intelligent Bots conversation message model and helps component developers build rich UI bot responses.
- Open a browser, and access the Oracle Mobile Cloud Enterprise homepage.
- Authenticate with the user credentials you defined when you provisioned the cloud service.
- Click the hamburger icon at the upper left to open the Oracle Mobile Cloud Enterprise menu.
- Click the Bots menu item (shown in Figure 2), which opens the Oracle Intelligent Bots dashboard in a separate browser window or tab.
- Click Import Bot at the upper right of the dashboard.
- In the opened dialog box, navigate to the location to which you extracted the downloaded zip file and open the starter-bot folder.
- Select the OracleMagazineOnlinePizzaBot4.zip import file, and click Open.
Note: You cannot import two bots with the same name. If you need to import the starter bot more than once or if you share an Oracle Intelligent Bots instance, rename any previous imports of the starter bot before importing the new bot. You can rename a bot by opening it, clicking the Settings icon (), renaming the bot, and exiting the bot.
- Close the upload confirmation dialog box, by clicking the X on the right side.
- Keep the browser window open.
Source – Oracle Blog