Chatbot Integration with Oracle JET
This tutorial needs a review. You can edit it in GitHub following these contribution guidelines. |
This document provides a step-by-step set of instructions guiding you through the process of integrating IBCS chatbots with the Oracle JavaScript Extension Toolkit (JET). JET empowers web and mobile developers by providing a modular toolkit based on modern JavaScript, CSS3, and HTML5 design and development principles.
Setting Up an Oracle JET Application
In this exercise you set up an Oracle JET application and explore its default content.
-
Follow the steps described in Setting Up an Oracle JET Application.
-
Open the project into an editor or IDE of your choice, such as NetBeans IDE, which displays the application as follows:
Spend some time browsing through the application structure. In the next section, you’ll be introduced to the main concepts of the application structure.
Setup your ChatBot to expose it via a Websocket
In this step, now configure the Intelligent Bot Webhook channel. Then try out the ChatBot from your Oracle JET application.
-
Return to the Intelligent Bot user interface in a new browser tab, select the Settings button on the left menu, then the Channels tab and finally click the Add Channel button.
-
Follow the instructions from the Configuration section of:
-
http://<bot server>:3000/samples/chat
if you’re using a Docker Image before 0.6 OR -
http://<botserver>:8888/source/apps/chat/overview
if you’re using a Docker image from 0.6
-
Integrate the ChatBot in the Application
-
In the application, in the
src/js
folder, create a folder namedjet-composites
. Unzip the content of the ZIP file into it, in a folder namedbot-client
:
-
In
js/viewModels/Dashboard.js
, add a reference tojet-composites/bot-client/loader
andojs/ojcomposite
in thedefine
block, to load thebot-client
component.
-
In
js/views/Dashboard.html
, set the following properties, belowvar self = this,
:
self.websocketConnectionUrl = 'ws://' <bot websocket> => check with the instructor;
self.userId = 'your userId used to send message to the bot';
self.channel = 'channelId, copy from your webhook definition';
Can’t get yours to work? Try 71DB044C-0624-4533-9C98-B8E76BAF919D
as the channel ID.
-
In
js/views/Dashboard.html
, define the view as follows:
<bot-client id="bot-client"
channel="[[channel]]"
websocket-connection-url="[[websocketConnectionUrl]]"
user-id="[[userId]]">
</bot-client>
. Run the application and interact with the ChatBot.
You have now hooked your ChatBot into an Oracle JET application.
Next Steps
Read the related Oracle JET Cookbook section in detail and include another CCA component from there.
Also read Creating Composite Components in the Oracle JET Developer Guide.
Congratulations! You have now learned how to create and load CCA components in your Oracle JET applications.
See Also
For more information about support for Oracle JET and a variety of HTML5 applications in the IDE on netbeans.org, see the following resources:
-
"Learn" section on the Oracle JET site. A set of official Oracle JET learning resources.
-
Working with CSS Style Sheets in HTML5 Applications. A document that continues with the application that you created in this tutorial that demonstrates how to use some of the CSS wizards and windows in the IDE and how to use the Inspect mode in the Chrome browser to visually locate elements in your project sources.
-
Debugging and Testing JavaScript in HTML5 Applications. A document that demonstrates how the IDE provides tools that can help you debug and test JavaScript files in the IDE.