Conditional Responses

Bot developers can design dynamic responses without writing any code by configuring rules in a GUI for Q&A bots and Task bots using Conditional response. In Q&A bots, the custom paths are defined for an article in the Responses console by setting the response type to conditional response.

In Task bots, these custom paths are created for a template in the Responses console after switching to ‘Conditional response’ response type. For each custom path, you must configure rules and responses (actions). If a consumer text or query matches any of the set rules, the response (action) linked to the rule is rendered to the consumer.

For instance, if the consumer query is about bill payment and the response varies depending on the user's type, you can now convey this information from the same response template. Once we know the user type, premium user or new user in this example, the conversation can be made scenario specific by creating different paths for premium and new users. Depending on the ‘rules’ that are satisfied (user type in this example), relevant response can be displayed to the consumer who selects the premium user option. This response is configured in the ‘Action’ section of each path. Similarly, you can create another custom path for fa new user by adding rules along with the response that must be displayed to the user.

Developers can also use consumer information received from the channel to define different paths and personalize responses based on the information available. For example, in app channel, developers can define different responses for anonymous and logged-in users if this information is available.

Configuring a conditional response for the Q&A bot

Use these steps to configure a conditional response for an article.

  1. Select a specific Q&A bot on the dashboard screen.
  2. Click the Articles tab on the left side. The knowledge base screen appears.
  3. Select the article to which you want to configure the response.
  4. Select the channel for which the response must be configured.
  5. Select the response type as Conditional response from the list. The Custom Paths Pullover window appears.
809
  1. Click +New on the Custom Paths Pullover window.
1087

Create a new path

  1. Specify the path name.
612
  1. Click Create to create the custom path for a response
  2. Click the newly created path and select Rules to define.
1057

Setting up rules for a custom path in the Q&A bot

  1. Specify If with OR, AND conditions based on which the rules must be executed and responses to be displayed:
    Left variable
    Common response variables contains the list of variables that you can use in this field to define rules. These variables can also be used to customize bot responses.
    Operator
    The operator that is used to execute the rule. Possible values:
    • Equals to
    • Not equals to
    • In
    • Exists
    • Does not exist
    • Greater than
    • Less than

    Data type
    The data type of the right variable. Possible values:
    • String
    • Variable
    • Integer
    • Boolean
    • Float
    • Array
    Note: Data types populate based on the selected operator.

    Right variable
    The type of variable value with which the syntax in the left variable must match.
    This field is displayed only when you set the Operator to any of these values:
    • Equals to
    • Not Equals to
    • In
    • Greater than
    • Less than
    You can also use the list of variables to define rules in the right variable of the conditional response type if you set the Data type to Variable.

  1. Select Actions to create a response for the defined rule. Bot responses can be personalized using variables received from the channel or collected from consumers over the course of conversation. The auto-complete functionality shows the syntax of variables in the text area when you start typing ${. Selecting the required suggestion auto-fills the area with the variable and highlights such variable.
1119

Specifying the action for a custom path in Q&A bot

1600

Auto-complete variables while composing responses

  1. Specify the response that must be displayed for the customer query once the rule is fulfilled.
  2. Click Save and Train to train the bot with these new responses.

📘

Note:

In case when none of the custom path rules are satisfied, the response specified in the ‘Default path’ is rendered.
You can also perform these actions on the custom paths pullover window:

  • Modify the pathname, using the Edit icon corresponding to the pathname
  • Delete a specific path, using the Delete icon corresponding to the pathname.

Configuring a conditional response for the task bot

Use these steps to configure a conditional response for a template key linked to an intent.

  1. Select a specific task bot on the dashboard screen.
  2. Click the Responses tab on the left side. The knowledge base screen appears.
  3. Select the template key of an intent for which you want to configure the response.
  4. Select the channel for which the response must be configured.
  5. Select the response type as Conditional response from the list. The Custom Paths Pullover window appears.
1278
  1. Click +New on the Custom Paths Pullover window.
1278

Create a new path

  1. Specify the path name.
608
  1. Click Create to create the custom path for configuring the response (actions).
  2. Click the newly created path and select Rules to define.
1107

Setting up rules for a custom path in the task bot

  1. Specify If with OR, AND conditions based on which the rules must be executed and responses to be displayed:
    Left variable
    Common response variables contains the list of variables that you can use in this field to define rules. These variables can also be used to customize bot responses.

    Operator
    The operator that is used to execute the rule. Possible values:
    • Equals to
    • Not equals to
    • In
    • Exists
    • Does not exist
    • Greater than
    • Less than

    Data type
    The data type of the right variable. Possible values:
    • String
    • Variable
    • Integer
    • Boolean
    • Float
    • Array
    Note: Data types populate based on the selected operator.

    Right variable
    The type of variable value with which the syntax in the left variable must match.
    This field is displayed only when you set the Operator to any of these values:
    • Equals to
    • Not Equals to
    • In
    • Greater than
    • Less than
    You can also use the list of variables to define rules in the right variable of the conditional response type if you set the Data type to Variable.

  1. Select Actions to create a response for the defined rule. Bot responses can be personalized using variables received from the channel or collected from consumers over the course of conversation. The auto-complete functionality shows the syntax of variables in the text area when you start typing ${. Selecting the required suggestion auto-fills the area with the variable and highlights such variable.
1233

Configuring the action for a custom path in Task bots

1232

Auto-complete variables while composing responses

  1. Specify the response that must be displayed for the customer intent once the rule is fulfilled.
  2. Click Save and Train to train the bot with these new responses.

📘

Note:

In case when none of the custom path rules are satisfied, the response specified in the ‘Default path’ is rendered.
You can also perform these actions on the custom paths pullover window:

  • Modify the pathname, using the Edit icon corresponding to the pathname
  • Delete a specific path, using the Delete icon corresponding to the pathname.

The output for the conditional response is rendered as shown below: