Build a Football Chatbot with the Oracle Digital Assistant – Part 3 (Channels)

This is the last part of the Football Chatbot series. In part1 the project started with the Chatbot definitions and design while part 2 focused on the backend Integration. In this last post, we look at the Channels and how to expose the Chatbot.

Wally's Email Makes No Sense - Dilbert by Scott Adams
From here

Channels

What are Channels? “Channels carry the chat back and forth from users on various messaging platforms to the digital assistant and its various skill bots. They also support user agent escalation, testing.

The Oracle Digital Assistant supports the below types of channels.

I will use the Oracle Web which uses an SDK to establish communication with the server, as seen below.

The Digital Assistant Client SDK for Oracle Web provides you with a widget that enables you to run a skill in a web page. Using the SDK, you can customize the look and behavior of this widget.The SDK connects to the Oracle Chat Server, the intermediary between the Oracle Web channel configured in Oracle Digital Assistant and the client. The chat server then passes messages to the skill for processing and delivers the skill’s response to the client.”

Download the SDK

You can find the downloads here ->https://www.oracle.com/downloads/cloud/amce-downloads.html

At the moment I write this post, this is the latest one : oda-native-client-sdk-js-21.02.zip

Create a Channel

Before we configure the SDK the ODA needs to have a Channel in place. Create one with type Oracle Web.

Choose the FootballBot as the Route To. It is still in Draft, but it since this is for testing purposes, it does not matter.

Make note of the Channel Id.

Install the SDK

I followed the instructions here in order to configure the SDK.

It’s quite easy. The SDK comes with an index.html where we need to add the below script.

The channelId comes from the Channel definition in the ODA, and the URI is the URL of the Chat Server. This is the configuration without any user authentication. That would require some extra steps.

<script>
        var chatWidgetSettings = {
            URI: 'oda-xxxxx-xxx.data.digitalassistant.oci.oraclecloud.com/',
            channelId: 'e9d7fffc-29f5-xxxxx-xxxxx-xxxxx-xxxxx'
        };
        function initSdk(name) {
            // Default name is Bots
            if (!name) {
                name = 'Bots';
            }
            setTimeout(() => {
                const Bots = new WebSDK(chatWidgetSettings); // Initiate library with configuration
                Bots.connect()                               // Connect to server
                    .then(() => {
                        console.log("Connection Successful");
                    })
                    .catch((reason) => {
                        console.log("Connection failed");
                        console.log(reason);
                    });
                window[name] = Bots;
            });
        }
    </script>

HTML Body

I added a very simple html body, with an image for the entire background.

<body> 
<img src="C:\project\championsleague.jpg" alt="cleague">
    <div>
        <header>
            <h1>Your Football Bot</h1>
            <p>always available</p>

        </header>
        
        <footer class="footer">
            <p>Football Chatbot Powered by the Oracle Digital Assistant</p>	
        </footer>
    </div>            
</body>

How it looks

Conclusion

This is the missing piece for a fully working Chatbot. The last 3 posts covered all the required steps, and showed how one can create a Chatbot , the Dialog Flow, the Backend Integration and the Communication Channel. While there were some shortcuts taken in this mini-project, the main ideas and steps are there, and provide a framework on top of which this Football Chatbot could be improved and brought to a production level.

1 Trackback / Pingback

  1. Build a FAQ Chatbot with Oracle Digital Assistant in 15 minutes – Tech Trantor

Comments are closed.