Skip to main content

Chatbots and Oracle Cloud Services

Thanks to Oracle A-Team, I had a chance to work with Chatbots.
3 pure NodeJS applications, on couple of Oracle Cloud platforms and Facebook messenger, and my chatbot was running.

Let me explain, the architecture a bit. To start with, following is the simple representation of how it works.





Message Platform Server : Is a NodeJS application, deployed on Oracle Application Container cloud, acts as a channel between Facebook Messenger and the chatbot engine. It simply converts the incoming messages from Facebook and sends it to chatbot readable format. Also, when chatbot replies, it converts to Facebook readable formats and passes it to messenger.

Chatbot Engine : Is a NodeJS application, which communicate with some REST APIs based on a conversation flow document and moves the flow of the conversation from one state to another.

Flow JSON : Where we document, every state of a conversation and which APIs to call to generate a response. For example, at the beginning of the conversation, start from "menu" state, and call "/start" API. The flow metadata file is driving the behavior of the bot engine.  The bot engine uses a finite-state-machine (FSM) to drive the conversation. Every step in the conversation is modeled as a state, and all possible next steps to move the conversation to a next state are defined as state transitions.  Every time a state is entered, the response elements defined for this state in the flow metadata are processed and the response is constructed and returned to the messaging platform.

Component APIs : Where several microservices are running, In my case I create a set of APIs, named Airport API which returns, starting from get flight info based on flight number, where is the check-in gate, baggage information, delayed flights etc.

Every component api should have a flow json, which defines that state transitions in the conversation and which APIs to call inorder to generate the response of the chat.

Now a bit more details about Component APIs and Flow JSON relationship.
In my case, Airport API, so I will explain my flow json in context to that.

First of all, below is the structure of each "state" in the flow json.


Each state has a "stateName", which generates a "response", using one or multiple component APIs. Optionally, it can also provides some options, which user can choose to further communicate with the chatbot.
Each of these options, generates an Event, which is mapped to another "state".

There is a special "state" called "stateTransitionError", it gets invoked when chatbot engine cannot translate/understand user input and it gives user option to navigate to the "start" state.

This is a simple, state transition map, only depicting a single flow.






The flow is written in Mustache(https://mustache.github.io/mustache.5.html). It is a simple “logic-less” template engine. It works by expanding tags in a template using values provided in a JSON object. It is "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values. A state definition in mustache looks like this :

{"name": "flightDetails", "type" : "response"
             ,"responseItems" :
            [ { "type":"prompt", "languages":
                 [{"language":"en","prompt": "Your flight departs at {{flowScope.departureTime}} , {{#isDelayed}} And, it looks like, your flight has reported a delay in departure. Sorry about that. {{/isDelayed}}"}
                 ]
              }
              ,{"type":"prompt","languages":
                 [{"language":"en","prompt": "Do you want, the following info on your flight?"}]
                ,"options" :
                     [{"payload" : { "event" : "immigrationInfo" }
                        ,"languages" :
                          [{"language": "en", "prompt": "Immigration Info"}]  
                       }
                      ,{"payload" : { "event" : "checkinInfo" }
                        ,"languages" :
                          [{"language": "en", "prompt": "Check-in Counter/Gate"}]  
                       }
                      ,{"payload" : { "event" : "onlineCheckin" }
                        ,"languages" :
                          [{"language": "en", "prompt": "Online Check-in URL"}]  
                       }
                      ] 
                       }
            ]
            ,"componentServices" : [{"name" : "getFlightDepartureTime"
                               ,"inputParams":[{"name" : "flightNo", "value": "{{flowScope.enterFlightNo}}"}]
                               ,"outputParams": [{"name" : "departureTime","scope": "flow"}]
                               }
                               ,{"name" : "getIsFlightDelayed"
                               ,"inputParams":[{"name" : "flightNo", "value": "{{flowScope.enterFlightNo}}"}]
                               ,"outputParams": [{"name" : "isDelayed","scope": "request"}]
                               }
                              ]
       }
 


Regarding the Flow, a multiple approach can be used, rather than writing a huge JSON document :
  1. Use Oracle Policy Automation to write the rules and state transitions
  2. Use Oracle BPM to define human taskflows
  3. Use a custom application where admin/business users can define the states and transitions, as well as pick up APIs from a catalog.
Either way, we have to make sure the end result is readable by the chatbot engine.

Here is a GIF of the running bot :




According to Oracle A Team, Oracle will soon release an intelligent bot cloud, which will be used then to replace the messaging platform server and chatbot engine.

Comments

  1. This comment has been removed by the author.

    ReplyDelete
  2. Wow Nice blog. It was really useful to create a messenger bot

    ReplyDelete
  3. What you have written in this post is exactly what I have experience when I first started my blog.I’m happy that I came across with your site this article is on point,thanks again and have a great day.Keep update more information.
    Chatbot Company in India
    Chatbot Company in Chennai
    Chatbot Development Company in Chennai
    Chatbot in Chennai
    Chatbot Development Company in India

    ReplyDelete
  4. Thanks for sharing Information to us. If someone wants to know about,I think this is the right place for you!

    Android App Development in Coimbatore
    Chatbot Development Company
    3D Animation Company

    ReplyDelete
  5. This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. chatbot online

    ReplyDelete
  6. Thanks for sharing very interesting post, I appreciate to blogger for amazing post.
    Mobile App Development Company in USA

    ReplyDelete
  7. outsourcingall.com "Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it.
    This paragraph gives clear idea for the new viewers of blogging, Thanks you. You’re doing a great job Man, Keep it up.
    Seo training in bangladash
    outsourcing training in dhaka
    Best Website Development and Design Company in Bangladesh
    free outsourcing training
    graphic design training
    digital marketing training
    affiliate marketing training
    outsourcing training

    ReplyDelete
  8. We have to thank and share such a nice blog post and interesting information. It is helpful for develop my knowledge, people always searching for this type of posts.
    AI Chatbot
    Chatbot Development
    RPA Bot
    Artificial Intelligence Company in Dubai

    ReplyDelete
  9. Thanks for sharing useful information.. we have learned so much information from your blog..... keep sharing

    Oracle Fusion HCM Online Training

    ReplyDelete
  10. Nowadays, the internet has made it a lot easier to learn from the comfort of home. cursos de ti

    ReplyDelete
  11. I think great site for these post and i am read the most of contents have useful for my Carrier.Thanks for these useful information.Any information are commands like to share him.
    Chatbot Company in Dubai
    Chatbot Companies in Dubai
    Chatbot Development
    AI Chatbot Development
    Chatbot Companies in UAE
    Chatbot Company in Chennai
    Chatbot Company in Mumbai
    Chatbot Company in Delhi
    Chatbot Development Companies

    ReplyDelete
  12. Claribot is an latest invention of Chatbot Development Company in Indiapowered by Claritaz, which is an answer-database enabled chatbot that helps in resolving customer-queries in a conversational fashion, incorporating keyword-based and semantic search.

    ReplyDelete
  13. Appsinvo was founded in 2015 and it is india-based company. Appsinvo is a Top Mobile App Development Company in India, USA and UK that develops unique, easy to use, high functionality and seamless operation that makes your web and mobile app more innovative. Since 2015, we have been delivering our services for the last 5 years in 120 countries and we have developed more than 300 mobile apps that makes more than 150 clients happy and satisfied with our services.
    Mobile App development company in Asia
    Top Mobile App Development Company
    Top Mobile App Development Company in Noida
    Mobile App Development Company in Delhi
    Top Mobile App Development Companies in Australia
    Top Mobile App Development Company in Qatar
    Top Mobile App Development Company in kuwait
    Top Mobile App Development Companies in Sydney
    Mobile App Development Company in Europe
    Mobile App Development Company in Dubai

    ReplyDelete
  14. Someone essentially lend a hand to make severely posts I would state. That is the very first time I frequented your website page and thus far? I surprised with the analysis you made to create this particular submit incredible. Fantastic job!
    AI Chatbot Development
    Chatbot Development
    Chatbot Development Companies
    Chatbot Company
    Chatbot Companies
    AI Chatbot Companies

    ReplyDelete

  15. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle ADF . Actually I was looking for the same information on internet for Oracle ADF and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more aboutOracle ADF . By attending Oracle ADF Training .

    ReplyDelete
  16. Hello everyone!

    Do you want to know how much chatbot development cost to get exceptional customer chatbot service to bring your business online. QSS Technosoft has well described about the estimation cost to develop chatbot solution.

    ReplyDelete
  17. Sharing the same interest, Infycle feels so happy to share our detailed information about all these courses with you all! Do check them out
    big data training in chennai & get to know everything you want to about software trainings.

    ReplyDelete
  18. Sharing the same interest, Infycle feels so happy to share our detailed information about all these courses with you all! Java Training in Chennai & get to know everything you want to about software trainings.

    ReplyDelete

Post a Comment

Popular posts from this blog

ADF Utility : Find UIComponent from Managed Bean

Many a times, it is required to find an UIComponent from ADF managed bean, to do something with it, for example : change the value of an af:outputText, change readOnly property of an af:inputText etc.     private UIComponent getUIComponent(String id) {                  FacesContext facesCtx = FacesContext.getCurrentInstance();          return findComponent(facesCtx.getViewRoot(), id);     }          private UIComponent findComponent(UIComponent base, String id) {                 if (id.equals(base.getId())) {             return base;         }         UIComponent children = null;         UIComponent result = null;         Iterator childrens = base.getFacetsAndChildren();         while (childrens.hasNext() && (result == null)) {             children = (UIComponent)childrens.next();             if (id.equals(children.getId())) {                 result = children;                 break;             }             result = findComponent(children, id);             if (result != nu

Exception Handling in ADF

This blog will give you an overview on how you can successfully deal with unhandled Runtime exceptions in an ADF application. This will give you an idea of: How to catch the unhandled exceptions. Write a separate log file with stacktrace and thread dumps. Redirect the user to an static error page #1. Catch unhandled exceptions :  Create a class "MyExceptionHandler" which extends : oracle.adf.view.rich.context.ExceptionHandler. Override handleException() method.     public void handleException(FacesContext facesContext, Throwable throwable, PhaseId phaseId) throws Throwable {         // this method is going to create a separate file with stacktrace and thread dumps         writeException(throwable);         // redirect to error page         redirectToErrorPage(facesContext);     }  Create a folder "services" inside : ViewController\src\META-INF and then create a file named "oracle.adf.view.rich.context.ExceptionHandler". In the file, add

Font Awesome with ADF

For people who are not aware of Font Awesome , it  gives you scalable vector icons that can instantly be customized — size, color, drop shadow, and anything that can be done with the power of CSS. Their whole icon library is based on CSS not Images. Recently, we had to build a tree table based on Webcenter content's folder and file structure. And we needed to show proper icons for files (pdf, word etc.) and folders. Which should look like this   We choose Font Awesome, because it is scalable and easy to use. But front-end was ADF, so we were a bit sceptical  about how to integrate both. Turned out it was quite easy. Special thanks for Casper Overweter to do the implementation. 1. Create an ADF Skin : Create a custom skin, via New > Gallery. Base it on alta-v1 skin. 2. Download Font Awesome : Download the zip form their website . It's free. Unzip it inside the "customSkin" folder. Next to your CSS. 3. Extend Font Awesome to your c