article by Frank Nimphius, February 2021

 

I don't know anyone who would decide today to spend their vacation in the same place for the rest of their life. But I know enough people who code their bots and their digital assistants to work on just one messenger. The main motivation for creating digital assistants and bots for a single channel is formatting text.

Honestly, formatted text has nothing to do with good conversational design, though I do understand that this is what users and stakeholders want. So, how can you give users and stakeholders what they want without tying your bot to a single messenger channel? The answer is Adaptive Bot Response Design (or Adaptive Bot Design for short).

I introduced the concept of adaptive bot design in an Oracle Digital Assistant Design Camp in August 2020 (see video here). Oracle Digital Assistant 20.12 introduced ICU (International Components for Unicode) formats for resources bundles, which provides one more tool to implement adaptive bot design.

In this article I show you how you can implement channel specific messages and formatting without locking your bot in. 

Example

Using resource bundles is a well-known best practice when creating multilingual chatbots, but also when creating channel-independent digital assistants. In Oracle Digital Assistant, you can build resource bundles on the digital assistant and the skill level.

Resource bundles are first created for a default language, which in my example is English. 

The message bundle string is shown in the image above, but also displayed in the code listing below. The resource bundle message uses an argument channelType that holds a value to be evaluated in the select format type. The code below prints a HTML formatted message if the bot channel is the Oracle Web SDK, a markdown formatted message if the  channel is detected as slack and no formatting at all for any other channel. Of course, the list of channels could be extended, to e.g. include msteams, if needed.

{channelType, select, 
websdk{This message is for the web and contains markup to show <b style="color:red">this</b> in bold using red font and <i>this</i> in italic}
slack{this is a message to show on slack it uses markdown to render *this* in bold and _this_ in italic}
other{ this message will be displayed if neither web nor slack is used. }}

The dialog flow (BotML) references the resource bundle through a variable of type "resourcebundle", which in the example below is named rb. The resource bundle key I created for the sample is "printMessage.message".

The channelType is explicitly flagged in the Apache FreeMarker expression that is used in the component's text property. The value that gets passed to the argument is system.channelType .

The system.channelType expressions returns websdk (for the Oracle Web channel), android (for the Android SDK), ios (for ISO SDK), msteams (For MS Teams), slack (for Slack), facebook (for Facebook), webhook (for a generic Webhook channel), twilio (for SMS) and so on.

So the system.channelType enables developers to build responses that match the requirements of a specific messenger channel. 

The conversation tester in Oracle Digital Assistant skills allows you to simulate different channels. As you can see in the image below, the simulator does not emulate a channel and therefore doesn't render HTML markup. However it does show that the message that gets printed contains HTML formatting directives. 

Running the same on the web channel then renders the formatted text as you would expect based on the HTML tags you see in the image above.

Setting the conversation tester to Slack as the channel and re-running the bot, prints the message that would be sent to Slack to display formatted text. As mentioned, the simulator does not emulate the messenger, which is why it doesn't show the formatting.

The webhook channel is not explicitly configured in the ICU formatted resource bundle and is therefore handled by the "other"  condition.

If you want to learn more about resource bundles in Oracle Digital Assistant and ICU messages in Oracle Digital Assistant 20.12 and later, then watch this Oracle Digital Assistant Design Camp recording.

Conclusion

Chatbots and the use of the conversational channel are driven by innovation and are constantly developing their capabilities. Building chatbots today shouldn't lock you into a specific messenger channel, but enable you to adopt new channels in the future. Think of speech as a channel. I think it is safe to predict that spoken language can be formatted through intonation and changes in the volume based on some kind of annotation added to a message. This annotation very likely IS NOT HTML markup. So if you build digital assistants and chatbots today and you can keep the option open to adopt future channels, then I don't see why you would want to tie it to a single channel. 

Related Content

TechExchange Quick-Tip: Optimize Bot Responses for a specific Channel in Oracle Digital Assistant

TechExchange Quick-Tip: How To Use Custom Channel Properties With Oracle Web SDK Messenger To Add Custom Metadata To Bot Responses

TechExchange Quick-Tip: Using RAW Message Payloads in Custom Components to Leverage Channel Specific UI Extensions (MS TEAMS Example)

 

 

Author