How to configure key-word based routing in Dialogue Studio

Introduction

There are multiple ways to create a bot. You could use a language understanding API, for example Dialog Flow. But you can also go for a simpler option, like scanning for key-words. An example could be that the customer says the name of the department they try to reach.

 

Preparation

Greeting

Our first step is initiate the bot, greet the customer.

We are going to start with a “Incoming conversation” node. This node only listens to both audio/video and Chat. This node is connected to our server using SignalR.

Steps:

  1. Drag and drop Incoming Call Node.

  2. Open Node:

    1. Select / Configure server.

    2. Filter on:

      1. All = If you want both a Voice- and Chat-bot.

      2. Audio/Video = If you want a Voice-bot.

      3. Chat = If you want a Chat-bot.

 

Next is greeting the customer, this can be done with a “Say” node. In here you can type the text, this will be converted to speech using the a Speech engine (Learn More).

Steps:

  1. Drag and drop a Say Node.

  2. Open Node:

    1. Enter text you want to play.

  3. Connect end of the Incoming Call node with begin of the Say Node.

 

(Optional) Split Voice- and Chat-bot

If you want a scenario for both a voice- and chat-bot you need to split up the dialogues. If you want either a voice- or chat-bot you can skip this step and continue with the specific interaction below.

If we want to handle both channels in one flow, we need to make a Switch.

Steps:

  1. Drag and drop a Switch Node.

  2. Open Node:

    1. Change Property to msg.session.type

    2. Add an option for the chat channel

      == Chat

    3. Add the option otherwise for audio/video

  3. Connect end of the Say node to begin of the Switch Node.

You can now continue with both the interactions below. Connect option 1 to the Configure with Wait for Chat, connect the otherwise option to either Configure with Ask and Wait or Configure with Transcriptor.

 

Configure with Ask and Wait (voice)

When using an Ask and Wait node, you need to pre-define all the options the customer can say. The advantage of this is you can have all variables covered and the flow will only continue when a configured phrase is spoken. The disadvantage it works for only for specific phrases (Example: "Sales, Support") and not sentences like "I would like to talk to Sales please".

 

To start we need to add a Ask and Wait node.

Steps:

  1. Drag and drop Ask and Wait Node.

  2. Open Node:

    1. Enter text you want to play, for example: Say the name of the department you would like to talk to.

    2. Switch Wait for to "Speech recognized".

    3. Enter the options in "Phrases", for example: sales,support

      Note Case sensitive, use lower cases.

  3. Connect end of previous node with begin of Ask and Wait Node.

 

Addition we are adding an “Say”, for if the customer doesn’t respond fast enough.

Steps:

  1. Drag and drop Say Node.

  2. Open Node:

    1. Enter text you want to play, for example: Sorry we didn't receive a response.

  3. Connect timeout of Ask and wait node with begin of Say node.

  4. Connect end of Say node with begin of Ask and Wait node or use it to escape to a fallback.

 

To map the detected phrase to an action, we will be using a “Switch”. We check if the “payload.speechDetected” equals one of our expected phrases.

Steps:

  1. Drag and drop a Switch Node.

  2. Open Node:

    1. Change Property to msg.payload.speechDetected

    2. Add an option for each phrase:

      For example: == sales

      Note Case sensitive, use lower cases.

  3. Connect result of Ask and Wait node to begin of Switch Node.

Next you can for example continue with a Enqueue action.

 

Configure with Transcriptor (voice)

Note Transcription needs to be configured, Learn More

When using a Transcriptor, sentences can be used for routing. In this case the sentence "I would like to talk to Sales please", can be searched for a specific key-word. Keep in mind that the customer could say anything and you need to catch unrecognized sentences.

 

The Transcriptor doesn't have a Say option, this needs to be added parallel. This can be done with a Say node.

Steps:

  1. Drag and drop Say Node.

  2. Open Node:

    1. Enter text you want to play, for example: Please say the department you would like to talk to.

  3. Connect the end of the previous node with begin of Say node.

 

For the Voice-bot to listen to the customer we need a transcription. This can be done with the Transcriptor node

Steps:

  1. Drag and drop a Transcriptor node.

  2. Open Node:

    1. Optional change the language of the node.

  3. Connect the end of the previous node with begin of the Transcriptor node.

 

By default the Transcriptor node will keep listening to the customer and restarting the flow. This is useful when integrating with natural language understanding API, which can hold an conversation (for example DialogFlow). In this case we need to stop after the first output. This can be done stopping the transcriptor with a stop payload.

Steps:

  1. Drag and drop Change node.

  2. Open Node:

    1. Create rule:

      1. Set: msg.payload.stop

        to: true (Boolean)

  3. Connect "events with transcriptor" end with begin of the Change node.

  4. Connect end of the Change node with begin of the Transcriptor node.

 

To map the detected key-word to an action, we will be using a “Switch”. We check if the “payload.transcriptor.transcript” contains one of our expected key-words.

Steps:

  1. Drag and drop a Switch Node.

  2. Open Node:

    1. Change Property to expression and use the following expression:

      $lowercase(msg.payload.transcriptor.transcript)

    2. Add an option for each phrase:

      For example: contains sales

      Note Case sensitive, use lower cases.

    3. Add an option otherwise, if no key-word has been detected.

    4. Switch match to "stopping after first match".

  3. Connect result of Transcriptor node to begin of Switch Node.

Next you can for example continue with a Enqueue action.

 

Configure with Wait for Chat (chat)

When using a Wait for Chat, sentences can be used for routing. In this case the sentence "I would like to talk to Sales please", can be searched for a specific word. Keep in mind that the customer could type anything and you need to catch unrecognized sentences.

The Wait for Chat doesn't have a Say option, this needs to be added first. This can be done with a Say node.

Steps:

  1. Drag and drop Say Node.

  2. Open Node:

    1. Enter text you want to play, for example: Please type the department you would like to talk to.

  3. Connect the end of the previous node with begin of Say node.

 

For the Chat-bot to listen to the customer we need a chat input. This can be done with the Wait for Chat node

Steps:

  1. Drag and drop a Wait for Chat node.

  2. Connect end of the Say node with begin of the Wait for Chat node.

 

Addition we are adding an “Say”, for if the customer doesn’t respond fast enough.

Steps:

  1. Drag and drop Say Node.

  2. Open Node:

    1. Enter text you want to play, for example: Sorry we didn't receive a response.

  3. Connect timeout of Ask and wait node with begin of Say node.

  4. Connect end of Say node with begin of Ask and Wait node or use it to escape to a fallback.

 

To map the detected key-word to an action, we will be using a “Switch”. We check if the “payload” contains one of our expected key-words.

Steps:

  1. Drag and drop a Switch Node.

  2. Open Node:

    1. Change Property to expression and use the following expression:

      $lowercase(msg.payload)

    2. Add an option for each phrase:

      For example: contains sales

      Note Case sensitive, use lower cases.

    3. Add an option otherwise, if no key-word has been detected.

    4. Switch match to "stopping after first match".

  3. Connect result of Ask and Wait node to begin of Switch Node.

Next you can for example continue with a Enqueue action.

 

Example action, Set Skill

Now that we have the menu in place, we can continue with an action. In this case we are continue to a Skill.

Note The Skill needs to exist on SharePoint, Learn More

Steps:

  1. Drag and drop Enqueue node.

  2. Open Node:

    1. Enter the name of the Skill.

  3. Connect the end of Say / Switch node with begin Enqueue node.