article by Frank Nimphius, July 2018

Update: Oracle Intelligent Bots has been rebranded Oracle Digital Assistant to better describe its capabilities beyond a standard chatbot. To learn more, visit cloud.oracle.com/digital-assistant

a common customer requirement for chatbots is the ability to run chatbots from a web site, web application or mobile applications. To simplify integration of Oracle Intelligent Bots in web and mobile applications, Oracle released a client-sdk for web, iOS and Android for download at

http://www.oracle.com/technetwork/topics/cloud/downloads/mobile-suite-3636471.html

 

Unlike normal SDK, which provide APIs only, the Oracle bot client-sdk provides a complete messenger client, ready for you to use. This means that all you need to do in Oracle Intelligent Bots, is to declaratively create a Web- , Android- or iOS – channel for your chatbot and then use the configuration information you obtain in the client-sdk configuration. 

How to e.g. use the web client-sdk is explained in the Readme files of the web-client sdk sample that you can download from OTN. The sample is setup such that you can run it immediately from your local host and access a chatbot on the public cloud. Very cool – you want to check it out.

How to Write User Profile Information

Commercial Messengers like Facebook provide information about the user that you can access using the "profile" system variable in Oracle Intelligent Bots. ${profile.locale} for example gives you access to the user locale while ${profile.firstName} and ${profile.lastname} give you access to the user name.

The same is possible using the web client-sdk, except that you – as the web application developer – pass this information to the bot when initialising the chat conversation. For this you have a JavaScript API available, which is Bots.updateUser( … )

The Bots.updateUser( … ) function takes a JSON object argument, for example

 Bots.updateUser(
            {
                "givenName":"Frank", 
                "surname":"Nimphius", 
                "email": "frank.nimphius@oracle.com"
                "properties": {
                    "locale": "de", 
                     "profession": "Product Manager"

                }
            }

        )

How to Read User Information

You read the user information using the ${profile.<property name>} expression. The "givenName" and "surname" properties are accessible in the bot as ${profile.firstName} and ${profile.lastName}. The "email" property (which is optional) can be accessed from ${profile.email}.

The custom properties added to the properties object too are accessible as ${profile.<property name>}, which is not so obvious. In fact the channel implementation will flatten the information to a single profile object. So the "preferredLocale" becomes accessible as ${profile.preferredLocale}. There is no limit and no restriction set to the number and names of the properties you add to the properties object. 

The BotML code is from a very simple sample bot that only reads and displays the name, mail and preferred locale from the user profile.

At runtime, using the web client-sdk sample (the one you can run immediately after downloading) the information of the BotML above is displayed as shown in the image below

 

Related Articles

10 Tips for Chatbot Success 

 

 

Author