About Building Custom Components

Oracle Digital Assistant doesn't have the built-in ability to connect to backend services such as databases and other systems of record. You can create your own custom component using the Oracle Bots Node SDK that can connect to any system in the cloud or on premises. For best results, host the custom component on Oracle Mobile Hub to take advantage of its authentication and logging capabilities.

The backend service can be any database or system of record that exposes a REST API that can be accessed by a Connector within Oracle Mobile Hub. In this Solution we use Oracle Autonomous Data Warehouse.

Architecture

This architecture shows how the skill connects to the system of record using a custom component and a connector.

The system consists of a user interface, Oracle Digital Assistant, Oracle Mobile Hub, and a system of record. The user interface is hosted on a web page, a mobile device, Facebook, or some other suitable host. Oracle Mobile Hub hosts the custom component and a connector. Access to the custom component is managed by a Backend within Oracle Mobile Hub. The connector handles communications with the REST API that system of record exposes.

Description of custom-component-architecture-omh.png follows
Description of the illustration custom-component-architecture-omh.png

Other architectures exist, but here we're focusing on one that uses Oracle Mobile Hub.

Before we get to the description of the system, let's define a few of the terms in the preceding diagram.

Oracle Mobile Hub
A cloud-based service that you use for developing, deploying, maintaining, monitoring, and analyzing and mobile apps.
Oracle Digital Assistant
A cloud-based service that you use for developing and managing digital assistants and skill bots. A digital assistant employs one or more skill bots to complete its tasks.
Backend
A backend plays a similar role as a webserver, but. instead of hosting web pages, it hosts APIs and other artifacts. The backend handles authentication and authorization tasks for the custom component API.
Custom Component API
The custom component is the part that you write with the help of Oracle’s open source Node.js SDK installed from npm. The bot uses the API at both design time and at runtime. At design time, the bot queries the custom component for a list of services that it supports. At runtime, the bot triggers the read/write operations that the custom component executes against the system of record.
Connector
A connector provides a level of abstraction between the custom component API and resources external to Oracle Mobile Hub such as a database or other system of record. Although you can connect to the external resource directly from the custom component, it's better to use a connector because changes made to the connection details of the external resource don't require any revisions to your custom component's code.
System of Record
The system of record can be any system that the Oracle Mobile Hub Connector can access, such as an on-premises database, a database in the cloud, or some other system.

This is how the system works:

  1. A user interacts with the digital assistant UI on Facebook, a web page, or a mobile device. For example, the user might use the digital assistant to place an order for a t-shirt.

  2. The digital assistant routes the request to the t-shirt order taker skill.

  3. The skill passes the details of the order to the custom component, which is an API that is hosted by Oracle Mobile Hub.

  4. The custom component then contacts the system of record through an Oracle Mobile Hub Connector. This is where you use the Oracle Bots Node.js SDK.

  5. The response from the system of record is passed back through the Connector to the custom component, which prepares the response for the skill to send to the digital assistant and then to the UI for displaying to the user.

Before You Begin

Install Oracle Bots Node.js SDK.

Use npm to install the SDK. The documentation at https://oracle.github.io/bots-node-sdk/ contains installation instructions.

Required Services and Roles

For this solution, you require access to Oracle Digital Assistant and Oracle Mobile Hub.

You'll also need access to a system of record. We assume Oracle Autonomous Data Warehouse in this Solution, but you can use any system that exposes its data through a REST API.

These are the roles needed for each service.

Service Name: Role Required to...
Oracle Mobile Hub: ServiceDeployer Allows configuration and metadata manipulation.
Oracle Mobile Hub: ServiceDeveloper Allows typical development and test access.
Oracle Digital Assistant:ServiceDeveloper Allows typical development and test access.
If using Oracle Autonomous Data Warehouse as the system of record: DWROLE or ADMIN Allows access and use of Oracle Autonomous Data Warehouse.

See Learn how to get Oracle Cloud services for Oracle Solutions to get the cloud services you need.