March 16, 2018

Oracle MAF: How to get the current row object of an binding iterator programmatically

[Oracle MAF 2.3.1]

Below is a code snippet helps to get the current object of a binding iterator from Java program in Oracle Mobile Application Framework (MAF).

AmxIteratorBinding ib = (AmxIteratorBinding)
           AdfmfJavaUtilities.evaluateELExpression("#{bindings.listIncidetnsIterator}");
oracle.adfmf.dc.bean.ConcreteJavaBeanObject obj=
           (oracle.adfmf.dc.bean.ConcreteJavaBeanObject)ib.getCurrentRow();   
IncidentVORow row=(IncidentVORow) obj.getInstance();


-- Where

  • #{bindings.listIncidetnsIterator} is binding iterator expression for a list of Incident objects
  • IncidentVORow is a bean class of incident object
  • "row" contains the current row of the iterator binding

March 1, 2018

Oracle Intelligent Bots: Chatbot integration with Facebook Messenger

Below is the procedure to integrate chat bot developed using Oracle Intellegent Bot Cloud Service (IBCS) with the Facebook channel.

  • Create a Facebook page
  • Make sure you see  "Send Message" button on the page like below

  • If you dont see this button, the follow the below steps, other wise continue to the integration
    • Click on the button or select Edit button option
    • Select "Send Messages" option under "Contact you"
    • Click Next
    • Select "Facebook Messenger" in the step2

    • Now you can see as below

    • Click on Finish. Now your facebook page is ready.
  • Now goto Facebook developer page: http://developer.facebook.com
  • Click on "My Apps"

  • Select "Add new app"
  • Give "Display name", email id and click on "Create App ID"
  • Products page will be opened
  • Mouse over to "Messenger" and click on "Set up"
  • Repeat the same for "Webhooks"
  • You can see both of them added under "PRODUCTS" on the left menu of the app
  • Selecte Settings under Messenger from the left menu
  • Scroll to "Token Generation" section
  • In the drop down under "Page", select the facebook page we created above
  • It will generate a "Page Access Token"
  • Click on the generated token. It will be copied to clip board
  • Open the bot for which you are creating this channel
  • Goto Settings and click on Channels
  • Click on "+ Channel"
  • Enter a name to the channel
  • Enter Description which is optional
  • Select Channel Type as "Facebook Messenger"
  • Paste the copied token into "Page Access Token" field
  • Copy "App Secret" from the facebook app's settings to "App Secret" field in bot
  • Enable channel and click on Create
  • You can observe channel created in bot for facebook with two extra fields Verify Token and Webhook URL. And the screen looks like as below
  • Go back to facebook messenger app page
  • Click on "Messenger", scroll to "Webhooks" section and click on "Setup webhooks"

  • Copy "Webhook URL" of bot to "Callback URL"
  • Copy "Verify token" from bot to this facebook app
  • Under "Subscription Fields", select messages and messaging_postbacks
  • Now the window will look like as below
  • Click on "Verify and Save" button which will create a webhook call back to your bot from facebook
  • Now you can see a new field in "Webhooks" section in the facebook app page
  • Select your facebook page from the drop down which is to subscribe your webhook to the page events
  • Once you select the page, a button "Subscribe" will be visible next to the drop down. Click on it
  • Now your facebook channel is ready to talk to the bot
  • Either make your facebook page public or add users as testers to the page to interact with the bot
  • Open facebook messenger and search for the name given to the facebook page and start sending messages to the bot. You will see the bot responses.



February 21, 2018

Oracle Intelligent Bots: Getting Started with Chat bots - My First Chat Bot- Part 2

Continuation of Oracle Intelligent Bots: Getting Started with Chat bots - Part 1

Now you have the basic knowledge about the Oracle chat bot environment. Let's see how to use this environment and create our first chatbot.

  • Click on New Chatbot

  • Enter Name of the bot which is a mandatory field, and description is optional
  • Your bot window will be opened
  • Before, doing further steps, the bot has a default flow to greet the user. So, let's test the bot first. 
  • Click on "Run" icon which is on top right corner
  • Test window will be opened
  • Type anything to start the bot flow. Let's say, "Hi". Now you can see the bot response as below
  • Let's see the dialog flow for this default bot
  • If you observe the dialog flow, we can see different sections but below are very important out of those
    • Variables: variables created to use in entire bot in any state.
    • States: To define the flow in various states. 
    • System.Intent: Is a component name which will map the user input with the corresponding intent and its state defined in the flow
  • Now, let's change this bot
  • Goto Intents
  • Click on the "+ Intent" button to create new Intent
  • Give a name to the Intent. Ex: MyBot
  • Give some statements to identify the intent under "Examples" section, which we call as utterances
  • Select "Flow" from left menu and write the YAML code as below
  • You can observe a button called "+ Components" on top left corner in "Flow" which provides a menu to choose system components
  • In the flow, the first state is "startBot" which is to identify the intent and the corresponding state 
  • If you enter any statement which does not match with any of the utterances, then it will go to "unresolvedIntent"
  • Now run the bot. Let's type "Hi" again. This time you can see a message which we defined to "unresolvedIntent"
  • Now, give any statement from the given utterances like "about". You can see the defined flow will be started. And the bot  will look like as below