> For the complete documentation index, see [llms.txt](https://mind-expression-docs.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mind-expression-docs.gitbook.io/home/how-to-guides/build-info-search-subjects/case-1.-data-usage.md).

# Case 1. Data Usage

### Before you begin

This tutorial requires a webhook setup. Add a test webhook URL `http://mock-webhook.mind.ai` to your webhook settings.

### Add a Subject

1. Click **Add Subject** on the Scope details page.
2. Select the `Info Search` tab.
3. Enter a Subject name.
4. Enter Query Statement which is the expected customer query as "How much data have I used on my account?"
5. 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**.

<figure><img src="https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2F06iPcSlXa4uv6NzCNF4S%2Fimage.png?alt=media&amp;token=425ecd04-cae4-46c7-9886-4204405f24ad" alt=""><figcaption></figcaption></figure>

6\. **Additional Query Statement to Recognize** may also be added but not required. This is used in case of multiple intents being expected to trigger this subject.

7\. Click **Add**.

### Build the Subject

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

<figure><img src="https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FXOFpE32Bnxb0TTqNEPce%2Fimage.png?alt=media&amp;token=8c949903-7c99-42ff-8a7c-a856ec6b78a9" alt=""><figcaption></figcaption></figure>

3\. In the popup, enter a Parameter Bundle name as "Check Month" and a Parameter name as "Month". Set it as required.

4\. Click **Add**.

<figure><img src="https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2F0OVE5s3QeAb1NjWpqljB%2Fimage.png?alt=media&amp;token=9147e455-6ce2-42e5-bb48-6d83eac0d0de" alt=""><figcaption></figcaption></figure>

5\. In the Component Settings panel, stay with the `Single Value` tab.

6\. Enter the local binding key as "month".

7\. Click **Set up Entity Type**.

8\. In the popup, select the `System Entities` tab.

9\. Select `Datetime Entity`.

10\. Click **Submit**.

11\. Click **Save**.

12\. Click **Add Action** in the Conversation panel.

13\. Under Check for Parameter, click **Check**.

14\. Stay with the `Customer` tab.

15\. Enter the prompt as "For which month?"

16\. Click **Save**.

<figure><img src="https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2Ff7EhFxXNfnX1Q7LkHE9u%2Fimage.png?alt=media&amp;token=4f901a03-220d-4c2c-b0d2-e10679fcbf66" alt=""><figcaption></figcaption></figure>

17\. Click **Add Action** in the Conversation panel.

18\. Under Completion of Parameter, click **Show response**.

19\. Select the `Webhook` tab.

20\. 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/data-usage?code=200`

**Webhook URL (Method: POST)**

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

\*\*URL PARAMETER `` **` `` tutorial/data-usage?code=200\`

**Response Body**

```
{
 "month": "July",
 "data-usage": "Your data plan is LTE+ (10G)\nYou have been using 4.3G.\nIf you want to change your mobile package, you can ask \"I want to change my mobile package\""
}
```

21\. Select the request method as `POST`. For the `POST` request, you can enter the Request Body if needed. Enter the Request Body.

**Request Body**

```
{
 "month": "{{month}}"
}
```

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

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

```
Sorry, I am terminating the session.
```

24\. Keep the Mapping toggle on.

25\. Enter Key and JSONPath pairings for Result Mapping.

**Result Mapping Pair 1**

**KEY** `month`

**JSONPATH** `$.month`

**Result Mapping Pair 2**

**KEY** `data_usage`

**JSONPATH** `$.data-usage`

26\. Enter the template to show to the customer as a response.

```
Data usage for {{month}}
- {{{data_usage}}}
```

27\. Click **Save**.

<figure><img src="https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2F81Uyld8SLz3HJKWdytfR%2Fimage.png?alt=media&amp;token=2f461518-9374-4016-9bbe-44ea244400dd" alt=""><figcaption></figcaption></figure>

28\. Click **Publish** to publish the Subject.

29\. To test the subject, click on the sandbox button on the right side of the screen and enter the query statement configured, in this case, `How much data have I used?`.

<figure><img src="https://2637928320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRqPwZJVepiA6JYXHnaO%2Fuploads%2FxuWhe2NmAp2vac96Nu2R%2Fimage.png?alt=media&amp;token=7c28608d-2d75-49ea-98b9-31a22c8d4b8b" alt=""><figcaption></figcaption></figure>
