Conditions

Conditions are very similar to Subjects, but they do not stand alone; they exist as a part of a Subject. A Condition adds a subordinate condition to the Subject and it must be validated.

Before you begin

  • This tutorial requires a webhook setup. Add a test webhook URL to your webhook settings.

    http://mock-webhook.mind.ai

Add Conditions

1. Click + Add Component in the Components panel.

2. Click Condition.

3. In the popup, enter the Condition name as "Prompt".

4. Click Add.

Set up Conditions

Each Condition requires Query Term only, but adding a Query Statement helps to better understand the customer query. The term and statement should be unique among the sibling Components.

1. Select the Prompt Condition to set up in the Components panel.

2. Enter Query Term as "No" which is the term directing to the Condition when it is called out from the customer, you can enter a Query Term by either entering a literal value, or using an entity. Know more about Entities.

3. Optionally enter Query Statement which is the expected query from the customer as "I don't want to schedule a visit". Additional Query Statement to Recognize can also be used but not required. This is used when multiple intents can be used for the condition.

4. Click Recognize Statement to get the Recognition Result. The Recommended Statement is the statement which is semantically related to more ontologies and can generally capture more statement structures with the same intent. To use the recommended statement, just tick the checkbox saying Use Recommended Statement.

5. Optionally select a reference that will create a shift in the current conversation flow. Having a reference means the conversation will be directed to the selected Component in the current Subject or to another Subject. Normal Components (Selections and Conditions) can be a reference only for normal Components. This case doesn't require a reference because we will continue building the following flow in the current Component.

6. Set up termination at this Component by turning the Terminate toggle on. Also. decide if you want to escalate the session by turning the Escalation toggle on or off. It will send the entire chat script to your backend system upon termination. You need to have an escalation webhook set up in the Scope to turn on the escalation.

7. Click Save.

Collect Query Term or Query Statement (Optional)

To collect the Query Term or Query Statement, you need to set up the Condition with Check. Only one Check action can be added to a Condition, yet it is optional. Check allows you to get the Query Term or Query Statement from the customer, system, or both.

Check with customer

Checking with the customer is a way to prompt the customer to get the value. This is an example in a Schedule a visit Subject to check with the customer if they do not want to schedule a visit, which will terminate the session with negation.

1. Click + Add Action in the Conversation panel.

2. Click Check and stay in the Customer tab in the Action Settings panel.

3. You can optionally enter an instruction to be displayed before the prompt in the Action Settings panel. This can be an instruction for the customer to follow or additional information. This form can include Mustache template language. Enter the message as below.

Our technician can visit you to examine the issue.

4. Enter the prompt to the customer.

Do you want to schedule a visit? If no, this conversation will be terminated.

5. Select the number of max prompt attempts which is how many times the prompts will be repeated in case of not getting the expected response.

6. Click Save.

When the Check action is set up, the expected customer response will be shown with the Recognized Query Statement of the Condition (or Query Term if there is no Query Statement).

Check with webhook

Check with webhook is a way to interface with your back-end system to get the value. This is an example in a Payment Subject to check with the system using a webhook if the payment was not successfully made, which will terminate the session with the term match.

1. Click + Add Action in the Conversation panel.

2. Click Check and select the Webhook tab in the Action Settings panel.

3. Choose a webhook URL http://mock-webhook.mind.ai to use from the dropdown and enter URL Parameter (domain path and/or query string) as tutorial/confirm-payment?code=200&exp=NA. It will return a "Not approved" Query Term for the Condition.

BASE URL http://mock-webhook.mind.ai

URL PARAMETER tutorial/confirm-payment?code=200&exp=NA


REQUEST PARAMETER

NA - Not approved
A - Approved

4. Select the request method as POST. For the POST request, you can enter the Request Body if needed. Enter the Request Body provided above.

{
  "card-no": "1234-1234-1234-1234",
  "holder": "Mind Expression",
  "exp-date": "12/25",
  "cvv": 1234
}

5. Select an error message display method as Template and select an action as Terminate to take in case of HTTP 400. If Passthrough is selected, the webhook response will be displayed without modification.

6. Enter an error message that will be displayed to the customer.

Sorry, I am terminating the session.

7. Decide if you want to escalate the session by turning the Escalate on Termination toggle on or off. It will send the entire chat script to your backend system upon termination. To turn on the escalation, you need to have an escalation webhook set up in the Scope.

8. Optionally, you can enter Key and JSONPath pairings for Result Mapping. This case doesn't require Result Mapping.

9. Enter JSONPath for Term Matching to extract a value to match the term literally.

$.result

10. Click Save.

When the Check action is set up, the result will be shown with the Recognized Query Statement of the Condition (or Query Term if there is no Query Statement).

Check with customer using webhook

Check with customer using webhook is a way to prompt the customer to get the value based on a system response. This is an example in a Current bill Subject to check with the customer using a webhook if they want to pay for the current bill.

1. Click + Add Action in the Conversation panel.

2. Click Check and select the Combined tab in the Action Settings panel.

3. Choose a webhook URL http://mock-webhook.mind.ai to use from the dropdown and enter URL Parameter (domain path and/or query string) as tutorial/current-bill?code=200. It will return a "multiple" Selection Term for the Selection Class.

BASE URL http://mock-webhook.mind.ai

URL PARAMETER tutorial/current-bill?code=200

4. Select the request method as POST. For the POST request, you can enter the Request Body if needed. Enter the Request Body provided above.

{
  "mobile-id": "101002000"
}
{
  "mobile-id": "201012001"
}
{
  "mobile-id": "301022002"
}

5. Select an error message display method as Template and select an action as Terminate to take in case of HTTP 400. If Passthrough is selected, the webhook response will be displayed without modification.

6. Enter an error message that will be displayed to the customer.

Sorry, I am terminating the session.

7. Decide if you want to escalate the session by turning the Escalate on Termination toggle on or off. It will send the entire chat script to your backend system upon termination. To turn on the escalation, you need to have an escalation webhook set up in the Scope.

8. Optionally, you can enter Key and JSONPath pairings for Result Mapping. Enter Key and JSONPath pairings as below.

Result Mapping Pair 1

KEY current-package

JSONPATH $.current-bill.current-package

Result Mapping Pair 2

KEY billing

JSONPATH $.current-bill.current-package-structure.amount

9. You can optionally enter an instruction to be displayed before the prompt in the Action Settings panel. Enter the instruction as below.

Your payment for this month is {{billing}}
Your current plan is as follows:
{{current-package}}

10. Enter the prompt to the customer

Do you want to make a payment?

11. Select the number of max prompt attempts which is how many times the prompts will be repeated in case of not getting the expected response.

12. Click Save.

When the Check action is set up, the expected customer response will be shown with the Recognized Query Statement of the Condition (or Query Term if there is no Query Statement).

Last updated