article by Frank Nimphius, January 2019

Messaging channels vary in the richness of their user interface. For example, Facebook supports rich media like images, card layouts, attachments, quick answers, and more. Other channels like WeChat or SMS do not provide the same UI functionality. As a bot designer you need to be able to adapt  bot responses to the channel that is used. Voice also is a good example of a channel that does not do well with rich user interface components. When using speech, the bot response should be simple and text-driven.

The term adaptive design for bots is not widely used (at least I did not find an article yet taking about it). To create bots that should be accessed from different channels, you as a bot designer should already be aware of this. Oracle Digital Assistant supports adaptive design in BotML, the CommonResponse component, and custom components, which basically means everywhere.

Use cases for adaptive design:

  • Show user interfaces that are optimized for a channel
  • Change the behavior of a bot based on a channel. For example, a specific channel might be more trusted than another, in which case you don't allow the same set of actions
  • Change the messages displayed to users. For example, users of the embedded test channel would see error messages in their purest form, while users would see in a less technical term

In this article I will show how expressions can be used in BotML to detect the user channel type and the channel name. The channel name is the name you give to a channel configuration in Oracle Digital Assistant. 

Different Messages for Different Channels

The simplest sample I can imagine is where the message and behavior of a bot is changed according to the channel that is used. The image below shows a message that recognizes the user to be a Q&A engineer for who the bot prints channel details and does not perform the attempted booking. 

The same bot accessed by a user from the web actually welcomes the user with his name and then performs the booking. It's easy to imagine how – if you once got a handle to the channel difference – you can use the channel identification to optimize the user experience. 

The following image shows the BotML code for this example. As you can see, a System.Switch component is used to navigate the bot conversation to a different state in the dialog flow based on the detected channel type.

For this it uses the  ${system.message.channelConversation.channelType} expression. The expression is accessible anywhere in BotML, so that it can be used on all user interfaces and functional components in Oracle Digital Assistant, which means that it can be used to 

  • show / hide components
  • navigate to specific dialog flow states
  • access different resource bundle strings for optimize labels
  • etc.

Also note that you can read the channelName property, which is a setting in Oracle Digital Assistant: ${system.message.channelConversation.channelName}

For example, imagine you use the webhook channel to connect with a messaging channel. In this case the channel type is returned as webhook, but the channel name still is unique for an implementation. 

Related Content:

TechExchange: Oracle Bots Node.js SDK: Building Webhook Clients for Oracle Intelligent Bots Made Easy

TechExchange: Oracle Digital Assistant Primer

Adding Alexa as a Conversation Channel to your Oracle Digital Assistant Chatbot

 

Author