Bot Block

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Designer User's Guide for version Current of Designer.

Use the Bot block to add a chatbot to your application.

About bots in Designer

Bots are software applications that apply automatic speech recognition and natural language understanding to listen and respond to customers in a way that resembles a conversation with a live agent. They can determine what a customer wants to do and then collect the information required to fulfill the request.

If you have a bot configured with a supported bot services provider, such as Google DialogFlow, Amazon Lex, or Genesys Dialog Engine, you can add it to the Designer Bot Registry. You can then use a Bot block to add the bot service to a Designer application.

Watch the video to learn more about using bots in Designer.

Using this block

The Bot block is located in the User interaction section of the palette. Add this block to the Self Service phase of a Default application when you want to use a bot service in your application. If the application is enabled for omni-channel, the same bot resource can service both voice and chat customers.

You can use multiple bot resources in an application. Simply add a Bot block for each bot resource you want to use.

For voice calls, the Bot block plays questions and responses that are returned from the bot service as text-to-speech (TTS) prompts. Using prerecorded audio prompts with the Bot block is not supported.

Intents and Slots tab

Use the settings on this tab to tell Designer which bot resource you want to use in your application. You can then configure the intents and slots for that bot service.

An intent is something that the customer wants to accomplish, such as booking a trip or making a reservation. Slots (also known as entities) provide additional context to the intent.

For example, let's say a bot detects that a customer wants to schedule an appointment. It now has the intent, but it also needs to know other details about the customer's request, such as the time, date, and the type of appointment. These are the slots, which the bot uses to determine the questions it needs to ask in order to collect the information needed to fulfill the customer's intent.

Configure Bot details

Use this section to specify the Bot provider and Name:

Des bot intents bot details.png

Once selected, Designer automatically populates the block properties with intents and slots for that bot resource.

Configure intents

Next, select the intents you want to enable for the bot:

Des bot intents configure intents.png

For each intent that you enable, Designer automatically creates a corresponding Bot Option block in the application flow.

Des bot option blocks.png

If you want Designer to perform special handling based on an intent, see Adding logic for handling intents for the recommended way to do this.

Intents and Slots assignment

Select the variables that will store values for the selected Intent and the related Slots.

Des bot intents assignments.png

Select a variable to send context to the Bot Session

This option enables you to pass an initial slot (or entity) value to a Lex or Dialogflow ES bot. This can be useful when an attribute is known before the interaction starts, such as the customer's name, phone number, or email address. With this slot already filled, the bot won't need to prompt the customer to provide this information.

To use this option, you'll need to set up a variable that contains a JavaScript object that defines the value you want to pass to the bot. Then, select this variable from the dropdown.

This also requires some configuration with your bot service provider, as you'll need to define an input context (or session attribute) for the slot and assign it a default value that corresponds to the JavaScript object. We've included an example that shows how to do this with a Dialogflow bot, but you can refer to the documentation from your bot service provider for additional information.

Example (Dialogflow ES)

For a quick example of how this works, let's set this up with a Dialogflow ES bot. First, we'll go to the Intents section of the bot and add a new Context. In this example, we've created an intent called Intent with context and added an input context to it, called ExampleContext.

Des bot block context 01.png

Then, for the slot that we want to pass an initial value to, we need to set a default value for an attribute of the context. To do this, we'll go to the Action and parameters section and add the details for the slot we want to fill with an initial value. In this case, we'll add details for the phone number attribute.

To assign the default value, we'll hover on the right-side of the row to reveal the additional options menu and click it to open the Default value setting:

Des bot block context 03.png

Now we can set the default value to match the name of the context and the attribute we want to fill:

Des bot block context 02.png

In Designer, we'll create a user-defined variable called varInput. For its value, we'll add a JavaScript object called ExampleContext that passes an initial value of 1234567 to the phone-number attribute.

For Dialogflow bots, the JavaScript object must contain the context name. Lex bots, however, do not use contexts. JavaScript objects for a Lex bot can use any name, but if multiple contexts are passed to the bot, it only accepts the first one and ignores the others.
    'attributes': {
      'phone-number': '1234567'
  'lifetime': 1

In the Bot block, we can then select this variable as the context to pass to the bot:

Des bot input settings context.png

Another example of how you could use this option is to pass an initial message to the bot to start a chat conversation. In the JavaScript Object, add a field called content that contains the message you want to send (e.g. "I want to book a hotel room."):

    'attributes': {
      'phone-number': '1234567'
  'content': 'I want to book a hotel room.',
  'lifetime': 1
The word content is a reserved keyword. Do not use content as the name of the variable that is passing context to the bot.

Invoking a Dialogflow ES bot with events

It's also possible to use an Event to initiate a bot interaction with a Dialogflow ES bot without requiring the customer to provide any input. The context is still passed normally when invoking the bot with an event.

To invoke the bot with an event, go to Dialogflow and set the Event field of the context object to the name of the event you want to invoke. For example, we'll add an event called sample-event to an intent:

Des bot block event df1.png

This is what the JavaScript Object looks like for the above example:

    'attributes': {
      'phone-number': '1234567'
  'event': 'sample-event',
  'lifetime': 1

If you set both an event and an initial message in the JavaScript Object, the bot ignores the initial message and uses the event.

Input Settings tab

If you are setting up a DialogFlow bot, you can select Use Streaming Audio to have Designer stream the audio inputs directly to the bot services provider. This enables the bot provider to transcribe the audio inputs and assign them to the appropriate intents and slots, which can improve the performance of these types of bots.

The Beep before listening for input option plays a "beep" tone after the bot asks the customer for input. When enabled, the Bot block only recognizes the input that is received from the customer after the beep has played.

You can also use this tab to adjust the Input timeout values for both voice and chat inputs. These settings tell Designer how long to wait (in seconds) before assuming that the customer did not provide any input to the bot.

Des bot input settings 3.png

Retry tab

If a bot doesn't understand a response from a customer, it asks the customer to try again until it understands the input being provided.

The retry settings on the Bot block work a bit differently than the retry settings on other blocks, such as Menu and User Input, in that you specify how the Bot block will respond to input that isn't recognized on a conversational level, for each of the question and response exchanges that take place between the bot service and the customer.

Use application-wide retry

Select this option if you want to use the retry settings that are specified on the Global Retry tab in the Application Settings.

Des bot retry use app.png

Allow retries

Select this option to specify specify retry rules for this block. When enabled, you can set the following options:

Number of No Input retries allowed

Select the number of retries to allow for each question and response sequence that occurs in the conversation between the bot service and the customer. For each retry, you can specify whether a prompt is played by clicking the corresponding section beneath this field.

For example, if you allow two no-input retries and you want to play a prompt after the first retry, select the No Input #1 line and add a prompt. Enable the Play original menu prompt after this retry prompt check box to repeat the menu prompts for the customer.

Number of No Match retries allowed

Most bots will follow-up with the customer if they don't understand the input that's been provided. For example, the bot will simply ask the customer to repeat the information until it successfully captures the response.

As this type of handling is typically built-into the bot by the bot services provider, you may not need to specify this setting in the Bot block.

After Final No Input

Add the prompt to play after the maximum number of permitted No Input retries is reached.

As this block is in the Self Service phase, you can also specify a target destination for the application to jump to, such as another block in the Self Service phase or to the Assisted Service or Finalize phase of the application.

After Final No Match

Add the prompt to play after the maximum number of permitted No Match retries is reached.

As this block is in the Self Service phase, you can also specify a target destination for the application to jump to, such as another block in the Self Service phase or to the Assisted Service or Finalize phase of the application.

Des bot retry allow.png

Results tab

Specify the variables that will hold various results data, as returned to the Bot block from the bot services provider. Each variable is described in more detail below.

Des bot results tab.png

Bot responses

Store latest response from bot

This variable stores details about the latest conversation that the bot engine had with a customer. For example, the results for a Dialogflow bot used to book a ghost removal service might look like this (JSON formatted):

  "status": {
    "code": 0,
    "message": null
  "data": {
    "botName": "MySampleServiceBookingBot",
    "botAlias": null,
    "sessionId": "ABC123",
    "state": "SUCCESS",
    "intent": "Book a Ghostbuster",
    "intentScore": 1,
    "slots": {
      "neighbourhoods": "Queens",
      "location": "backyard",
      "date": "2020-01-11T12:00:00-05:00",
      "ghost": "Zuul the Gatekeeper"
    "slotsData": null,
    "inputTranscript": "today",
    "message": "",
    "attributes": {},
    "error": null,
    "recognitionConfidence": null,
    "stability": null

In the example above, some of the details that were returned include:

  • botName – name of the bot that was invoked.
  • sessionID – unique ID assigned to the session.
  • state – indicates SUCCESS if everything worked.
  • intent – the intent that was detected (i.e. what the customer wanted to do).
  • slots – the details that the bot collected from the customer to fill the associated slots (or entities) for the intent.
  • inputTranscript – the utterance (voice or chat input) that the bot received from the customer.

Store bot invocation result code

This variable stores the HTTP status code received from the bot when it was last invoked by the application. For example, a result code of 200 (OK) indicates that the bot was successfully invoked.

Other result codes, such as 401 (Unauthorized) or 403 (Forbidden), can indicate there was a problem reaching the bot service.

Bot status flags

Bot invocation or system error

If true, this indicates that Designer was not able to successfully reach or invoke the bot service. There could be an issue with the system, or you might need to check the credentials provided for your bot service in the Bot Registry. Otherwise, this returns false.

Bot engine execution error

If true, this indicates that Designer was able to communicate with the bot, but an error occurred while the bot engine was processing the request. For example, the bot returned an incorrect response and triggered the Error Handler block. Otherwise, this returns false.

Viewing the results data

You can view the results data in Designer Analytics by going to the Session Detail Records dashboard. In the All Events panel, find the application instance you want to check and then filter or search for the data you want to view.

For example:

Des bot results sample.png

Adding logic for handling intents

To specify additional logic for handling intents, Genesys recommends using a Segmentation block to define different pathways for the application to take when certain intents are detected.

In this example, a segmentation block is configured as Intent Fulfillments, with conditions added based on intents:

Des bot intent fulfillments.png

For each intent added as a condition, Designer creates a corresponding Segment block in the application flow. You can then build additional logic for an intent by placing child blocks under these Segment blocks. For example, you might want to call a Shared Module that fulfills that intent.

For more information about setting up segmentation blocks and condition expressions, see the Segmentation block page.

Retrieved from " (2021-09-18 16:29:31)"