article by Frank Nimphius, February 2020
A common requirement for media used in chatbot conversations is to show them in place within a messenger. The new Oracle Web SDK does render videos embedded in the conversation. In this article I explain how you embed YouTube videos in your chatbot conversations.
On YouTube, Oracle Digital Assistant is covered within the 2-Minutes TechTips series hosted on the Oracle GroundBreaker channel. One of the videos I quite like is about the integration of Oracle Digital Assistant in Oracle JET. In the video, Geertjan Wielenga (picture below) from the Oracle JET team explains how to integrate Oracle Digital Assistant in Oracle JET web and hybrid mobile applications.
In this I will integrate Geertjan's video in a bot conversation for display in Oracle Web SDK messenger.
To display YouTube videos, all you need is the YouTube video URL. Pressing the Sharing option for a YouTube video allows you to get access to the URL (see image below)
Note: Geertjan's YouTube video URL: https://youtu.be/1tmzmhK6wNA
In Oracle Digital Assistant, you use the System.CommonResponse component with a configuration for attachments to your dialog flow. The easiest option for adding the System.CommonResponse component, also shown in the image below, is to use the "+ Components" button located on top of the dialog flow editor.
In the opened dialog, select the User Interface category and then choose the Common response – attachment menu item. As shown below, enable the toggle to not paste component comments. If you are new to the System.CommonResponse component, then please have the comments pasted to the dialog flow to learn about what individual properties are for.
The dialog flow code in the image below first writes the YouTube URL to a dialog flow variable. The reason for using a variable is that in a real bot use case, it is unlikely that you would use a hard coded video URL reference. Instead a custom component most likely would be used to query the information about the video to display and then set the video URL to the variable referenced in the System.CommonResponse component (line 30 in the image below).
The showVideo state contains the System.CommonResponse component to display the video. Notice the responseItems property, which has a single response item (it could have many) of type attachment.
To use the Oracle Web SDK messenger (requires Oracle Digital Assistant 19.10 and later) with the YouTube skill, you need to create an Oracle Web channel. Select the skill you want to expose on the Web channel (you can download a simple sample skill at the end of this article) and take a note of the channel Id and the Oracle Digital Assistant root URL (you can read this from your browser's address field).
When you add the Oracle Web SDK messenger to your website, or web application, then you need the channel Id and the Oracle Digital Assistant URL as configuration parameters.
Finally, when launching the web site with the Oracle Digital Assistant messenger in it, and bringing up the messenger window, you will see YouTube video embedded in the conversation (image below)
Related Content
TechExchange: All 2-Minutes Oracle Digital Assistant Tech Tip Videos on YouTube (Also contains videos about the Oracle Web SDK)
Overview of the new Oracle Web SDK and its customization features in Oracle Digital Assistant 19.10 and later