Integrating Chatbots with your APEX (or non-APEX) web application

Craig Sykes Apr 26, 2018 12:43:30 PM

Lots of people are talking about chatbots alongside other tech buzzwords like AI and IoT. I like to look into these up and coming technologies to see what might be useful for expanding our development toolbox, and I have presented on these three topics recently at various conferences.

Of all these technologies, chatbots have stood out to me as something that could really help businesses interact with their customers and could lead to new forms of application interaction that are actually viable in a real-world use-case.

For example, chatbots can replace first line interaction with customers, moving simple tasks like password resets or frequently asked questions to the AI and saving valuable human interaction time for the more complicated issues.

The first thing I do when looking at new technology is to see what everyone else is doing and decide which version of the technology I am going to concentrate my efforts on. This usually consists of offerings from lots of well known, “trendy” companies, so I was pretty surprised to see an offering directly from Oracle. I was even more surprised to see that it was actually awesome!

The Oracle Intelligent Bots service is part of the Oracle Mobile Cloud suite and allows you to build your chatbots directly in the clean, intuitive Cloud IDE.

Oracle financial bot

Development of a bot is split up into 5 stages:

Intents

Intents are the phrases that you want your bot to listen for. In the banking bot example above, we have an intent called Send Money. This intent can be triggered by any of the following developer defined phrases:

Banking bot

When the user types something to the bot, if it can match what was said to one of these phrases, and is over a certain percent confident of the match, then the intent will be invoked.

Entities

Entities are variables that are passed to the bot’s code from the user’s typed phrase. If the bot can identify instances of these variables from what was typed, then it will pass them on, if it can’t then it can prompt the user for more information. In the screenshot below we can see an AccountType entity, which has a list of values to be either listened for or presented to the user for entry.

Entities

Flows

The bulk of the chatbot code is contained in the flow. The best way to describe this is to think of a children’s ‘Choose Your Own Adventure’ book. The user works their way through the defined flow and actions are fired based on what the user types or chooses. The flow can ask the user for more information, display text results or call out to components.

There are lots of examples of how to lay out the flow code available from Oracle here – it is written a pretty simple markup language (a custom implementation of YAML) that is very human readable.

Components

Components are where you will connect your bot to your data. If the user wants to know their bank balance, then once the bot has worked this out and acquired all the relevant information, a component will be called to get this information from the database. This data could be anywhere, as long as you can access it via a web service call.

Components

Integration

Once you’ve created your chatbot, you need to give your users a way to talk to it. You can connect to any platform you like that accepts external connections, but there are a few in-built ones. The easiest integration I found was with Facebook messenger. It’s a case of copying a few URLs and keys across from one to the other, and you end up with a Facebook page that end users can message use to interact with your chatbot. Human page admins can also see every conversation and jump in if needed.

To take this integration further, you can plug the facebook messenger client into any web application. Below is a screenshot of an APEX application with a Facebook chat plugin, providing application users with instant access to a chatbot.

Integration

The whole process is really easy and is only limited by your imagination. If you want to learn more, there are some great videos on the Oracle Mobile Platform YouTube channel.

You can also come to the UKOUG Northern Technology Summit in Leeds on 16th May where I will show you how to do all of this in my presentation: APEX AI: Communicating with your Applications Using Chatbots and Speech Recognition (I will be delivering a similar presentation at KScope 18). You can also see Grant Ronald from Oracle presenting on the topic too with: The New Frontier: Mobile and AI Powered Conversational Apps.

 


 

Author: Craig Sykes 

Job Title: Senior Oracle Development Consultant

Bio: Craig is a Senior Development Consultant at DSP-Explorer. Craig has an MSc in Computing Science and is an experienced software engineer, utilising development tools such as PL/SQL and APEX to provide bespoke ERP software to both UK and international businesses. Craig has experience developing solutions to connect Oracle systems to a wide range of existing external applications within business environments.