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.