Menu

Connecting Oracle Mobile Application Framework (MAF) with Oracle Intelligent Bots

Chatbots, MAF, OracleMobile By Apr 13, 2018 1 Comment

Introduction

In this post, we will see how to create a client in Oracle Mobile Application Framework (MAF) to connect with chatbot developed in Oracle Intelligent Bot. In this example, I am using bot version 18.1.1 and sample server in the bot instance.

To achieve this, we need to
  • Create a webhook channel in Bot
  • Create a channel in web socket server
  • Create a client in MAF

Create a webhook channel in Bot

  • Go to settings in bot service
  • Select Channels tab
  • Click on “+ Channel” button, a window will be opened to create a channel
  • Fill name and description fields
  • Select Channel Type as “webhook”
  • Platform version as “1.1 (Conversation model)”
  • Fill Outgoing webhook URI as below (Below is a sample url if you are using sample server and channel id you can copy from webhook url. If you are using other server, please fill this accordingly)
    • https://bots-samples-nodejs:8889/ext/apps/chat/bots/<channel id>/messages
  • Enable the channel and Click on create

 

Create a channel in web socket server

  • Open admin console of the sample server : http://<host>:8888/ext/apps/chat/admin/
  • Select Channels tab
  • Click on “New Channel” button
    • Fill name and description
    • Copy server key and webhook URL from the bot created above and fill here
    • Click on Save

Create the client in MAF

Please follow below steps to integrate MAF with the web chat client widget.
  • Go to dev-resources of the bot instance and download the web client source code
  • Create a MAF application
  • Go to folder structure and navigate to public_html folder under ViewController folder of the app
  • Copy web client source code folder inside the public_html folder
  • Go to jdeveloper, open maf-feature.xml
  • Click on + icon and create a new feature
  • Under content, select type as “Local HTML”
  • In the copied chatclient folder, there is an index.html page. Select this page for URL under the feature content
  • Open settings.js file inside the chatclient folder
  • Update the Uri and channel id with your bot details
  • User id is hardcoded here to “Anand”, but you can pass username at runtime if required
  • Now, run the app, a chat window will appear in the app

1 Comment

  1. Manuel says:

    thanks, nice write.
    But i cant find the chat-widget-web.js and the settings.js, could you send me it please.

Leave a comment

Hi, Welcome here.
JOIN OUR NEWSLETTER
And get notified everytime we publish a new blog post.