# Parameter Bundles

### Before you begin

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

```
http://mock-webhook.mind.ai
```

* This tutorial requires two entity types for the Parameter setups. Add regex entity types "Account Number" and "MSISDN" in Knowledge.

**Account Number**

**Regex Pattern Block 1**

**REGEX PATTERN** `^[0-9]{8}$`

**DESCRIPTION** `8 digits`

***

**MSISDN**

**Regex Pattern Block 1**

**REGEX PATTERN** `[nN]?[fF] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ? [0-9] ?[0-9]`

**DESCRIPTION** `9 digits: 1st digit can be n or N, 2nd digit can be f or F`

***

**Regex Pattern Block 2**

**REGEX PATTERN** `[1,2,3,6,8,9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]`

**DESCRIPTION** `7 digits: 1st digit can be 1,2,3,6,8,9`

**Regex Pattern Block 3**

**REGEX PATTERN** `[1,2,3,6,8,9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]`

**DESCRIPTION** `8 digits: 1st digit can be 1,2,3,6,8,9`

**Regex Pattern Block 4**

**REGEX PATTERN** `[0,1,2,6,8,9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9]-?[0-9](-?[0-9A-Za-z])?`

**DESCRIPTION** `10 digits with " - " in between of each digit`

**Regex Pattern Block 5**

**REGEX PATTERN** `[0,1,2,6,8,9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9] ?[0-9]( ?[0-9A-Za-z])?`

**DESCRIPTION** `10 digits: 1st digit can be 0,1,2,6,8,9 and last digit can be 0-9, A-Z, a-z)`

### Add Parameter Bundle

Add a Parameter Bundle to set up each Parameter.

1. Click **Add Component** in the Components panel.
2. Click **Parameter Bundle**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2Fj9718ktFDOG7O1HAPmun%2F2.png?alt=media\&token=e85179ec-ff1c-4188-afe7-f433f288b1fc)

3\. In the popup, enter Parameter Bundle name as "Verify" and Parameter names as "Name", "Product", and "Phone Number".

4\. Deselect the Required checkboxes of `Phone Number` Parameter as they are optional.

5\. Click **Add**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FvCQ6bJyspb2xAohSHTbc%2F5.png?alt=media\&token=987d328d-a5c0-47c7-ad9b-927e43dd421c)

### Set up Parameters

To start setting up a Parameter, see if the Parameter is required or optional first. As mentioned above, optional Parameters are not invoked by default. For optional Parameters, you can set a Binding Expression which is a JSONPath expression to extract a default value from the conversation context, which is most likely a return value from a webhook. You can also set a Default Value, which is the specific value of the Parameter. If the customer gives another value, the Parameter is overwritten with the value provided by the customer.\
\
Also, check if the Parameter value is single or compound. A single value means the Parameter has only one entity as a value, while a compound value possibly includes multiple entities. Compound value Parameters need Designator. Key Path to indicate the specific value to use among the values. If the value that you want to extract is in the collection, write a chain of keys without specifying the location inside the collection.

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

{% tabs %}
{% tab title="Required Parameters" %}
**For Single Value**

1. Select the `Name` Parameter in the Components panel to set it up.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FLisxbAhcm34QRzmFnS8C%2F1.png?alt=media\&token=40571769-eced-45ef-8b73-d7cc756b4e4d)

2\. In the Component Settings panel, stay in the `Single Value` tab.

3\. Enter "Name" for Local Binding Key. This key will be used locally in the current Subject and store the Parameter value.

4\. You can optionally enter the data source, which is a collection of objects where data is extracted via the key list. This case doesn't require the data source.

5\. Set up the entity type to determine the data type of Parameter as "Any Entity" in System Entities.

6\. Click **Save**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FN3Pc3Adz6PiYylgp0N0W%2F6.png?alt=media\&token=f495155c-e442-4f8e-b0c9-281f9f7aced2)

**For Compound Value**

1. Select the `Product` Parameter in the Components panel to set it up.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2F1SlrdexezSczIC6x4PEE%2F1.png?alt=media\&token=80e681ef-6408-4910-94d4-0934705fde82)

2\. In the Component Settings panel, select the Compound Value tab.

3\. Enter "Product" for Local Binding Key. This key will be used locally in the current Subject and store the Parameter value.

4\. You can optionally enter the data source, which is a collection of objects where data is extracted via the key list. This case doesn't require the data source.

5\. Set up the entity type to determine the data type of Parameter as "Account Number" in My Entities. Compound Parameters can have multiple entity types.

6\. You can optionally enter Designator. Key Path, which is the chain of keys indicating the specific value to refer to. Enter Designator. Key Path as "$.mind-visions.id".

7\. Click **Save**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FlLOFWsQEKZpGBBs4lJhQ%2F7.png?alt=media\&token=cafc9802-cdab-475d-8843-064e25530d7c)
{% endtab %}

{% tab title="Optional Parameters" %}
**For Single Value**

1. Select the `Phone Number` Parameter in the Components panel to set it up.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FZmDIc0HquVTdro71DgPJ%2F1.png?alt=media\&token=1bf79b09-d744-44b9-a9d7-eedda0ee7a67)

2\. In the Component Settings panel, stay in the Single Value tab.

3\. Enter "PhoneNumber" for Local Binding Key. This key will be used locally in the current Subject and store the Parameter value.

4\. You can optionally enter the data source, which is a collection of objects where data is extracted via the key list. This case doesn't require the data source.

5\. Set up the entity type to determine the data type of Parameter as "MSISDN" in My Entities.

6\. You can optionally enter Binding Expression, which is a JSONPath expression to extract a value from the conversation context when the Parameter isn’t called out by the customer, or enter Default Value, which is a preset value when the Parameter isn’t called out by the customer. This case doesn't require a default value.

7\. Click **Save**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FIe3M7ieA6vGTRs2ALKtl%2F7.png?alt=media\&token=0248919d-e6f1-49c8-bed6-0aeeb1828354)
{% endtab %}
{% endtabs %}

### Collect Parameter Value

To collect the Parameter value, you need to set up a Check action to the Parameter. Check allows you to get the Parameter value from the customer, or both customer and system.

{% tabs %}
{% tab title="Check with customer" %}
Check with customer is a way to prompt the customer to get the value. This is an example in a `Verify customer` Subject to get the `Name` Parameter value from the customer.

**CONVERSATION PREVIEW**

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2F6Jy6xk9gd4USdALVJ3eS%2FScreen%20Shot%202022-06-03%20at%203.21.48%20PM.png?alt=media\&token=419045df-851a-4889-95ff-ba37d55c63e0)

1. Select the `Name` Parameter in the Components panel and click **Add Action** in the Conversation panel.
2. Click **Check** and stay in the `Customer` tab in the Action Settings panel.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FbiOMSNgD51xyi61aMjAQ%2F2.png?alt=media\&token=4d8b8265-956f-4571-a3b9-16888451dfce)

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.

```
Let me verify your name.
```

4\. Enter the prompt to the customer as "What is your full name?".

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**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2Fqq1AY7X61u4rWgGPMddJ%2F6.png?alt=media\&token=4d0504c8-eb67-407d-ae90-1ef161394ee5)

When the Check action is set up, the expected customer response will be shown with the binding key.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FYOu00JyhnfsLP7wx3RtN%2F1.png?alt=media\&token=88e9b3f5-9b6c-4cfb-a229-28a362cc37ed)
{% endtab %}

{% tab title="Check with customer using webhook" %}
Check with customer using webhook is a way to prompt the customer to get the value. This is an example in a `Verify customer` Subject to get the `Product` Parameter value from the customer using a webhook.

**CONVERSATION PREVIEW**

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2Fcxcxf5wQHAEbFU7Ay5mN%2F1.png?alt=media\&token=0b9a9cd1-8477-4ce6-b806-5002744566f7)

1. Select the `Product` Parameter in the Components panel and click **Add Action** in the Conversation panel.
2. Click **Check** and select the `Combined` tab in the Action Settings panel.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FZz5izslbXYCtUy1nF5uf%2F2.png?alt=media\&token=ead94281-ed33-4c1d-a715-5591504b607b)

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/tv-account?code=200&out=m`.

***

**Webhook URL (Method: GET)**

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

**URL PARAMETER** `tutorial/tv-account?code=200&out=m`

***

**Response Body**

```
{
  "mind-visions-quantity": "multiple",
  "mind-visions": [
    {
      "name": "Mind Vision",
      "id": "92741023",
      "etc": "Mind Economy Package",
      "desc": "Mind Economy Package with 120 channels"
    },
    {
      "name": "Mind Vision",
      "id": "91244132",
      "etc": "Mind Sports Extra Package",
      "desc": "Mind Sports Extra Package with 180 channels"
    },
    {
      "name": "Mind Vision",
      "id": "72364018",
      "etc": "Mind Movie Lover Package",
      "desc": "Mind Movie Lover Package with 250 channels"
    }
  ]
}
```

4\. Select the request method as `GET`.

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 the 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 pairing as below.

**Result Mapping Pair 1**

**KEY** `mind-visions`

**JSONPATH** `$.mind-visions`

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

```
Account List:
{{#mind-visions}}
  {{name}}: ({{id}})
{{/mind-visions}}
```

10\. Enter the prompt to the customer as "Which account do you want to continue with?"

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**.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FBmKBP3UIfVbr9pXDTf6C%2F12.png?alt=media\&token=b81c620c-2015-4de6-a7a3-a5340016f21d)

When the Check action is set up, the expected customer response will be shown with the binding key.

![](https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2F7UW3NlLzEPw1KgSYU9Vl%2F1.png?alt=media\&token=e11d3a3e-cf26-44d7-9aee-7048a8180b34)
{% endtab %}
{% endtabs %}
