> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Digital Views

In this how-to, we'll walk through a Banking App scenario where a user views account details through Digital Views — presented via Panels and Widgets, and hosted on a Web/Mobile Client using the Widget SDK.

For details on what Digital Views are and how they're implemented on the Platform, see [Digital Views](/ai-for-service/automation/digital-skills/digital-views).

## Illustration with an Example

Consider a Banking App trying to address the following scenarios:

<video controls className="w-full aspect-video rounded-xl" src="https://mintcdn.com/koreai/PGJcv6R9Fdn8ZDgm/ai-for-service/automation/digital-skills/images/bank-bot.mp4?fit=max&auto=format&n=PGJcv6R9Fdn8ZDgm&q=85&s=8fb8cc87bee61e203b8f8eacd955d7b0" data-path="ai-for-service/automation/digital-skills/images/bank-bot.mp4" />

This document gives a detailed step-by-step approach to achieving all the above-mentioned scenarios using – Digital Views (Panels, Widgets), Widget SDK and Web/Mobile Client.

## Prerequisites

* App building knowledge
* A Banking App with a **Get Balance** dialog as mentioned below.
* Get Balance – Dialog task prompting the user for their Account Number and Account Type and displaying the available balance in the account.

  <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/get-balance-dialog-task.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=9d2823da79787141a6e56b1f8c167331" alt="get balance" width="944" height="440" data-path="ai-for-service/automation/digital-skills/images/get-balance-dialog-task.png" />

## Configurations

Let's consider each of the following configuration scenarios:

1. Dialog Task to display balance in a given account using Widget SDK channel.
2. Widgets to trigger the above dialog task and a Panel set with the widgets.
3. Panel to hold a widget displaying static JSON template message.

### Message Template

First, the Dialog task which would be triggered from the Widget should have a message definition for the Widget SDK channel.

<img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/message-template.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=4d4048aef639a2f1298d8e18b7d75700" alt="message template" width="1366" height="768" data-path="ai-for-service/automation/digital-skills/images/message-template.png" />

We use the following message to display the account details:

```
var output = 'The Balance in your' + context.entities.AccountType + ' account is ' + context.GetAccountBalance.response.body.Balance;
var message = {
    "elements": [
        {
            "title": "Account View",
            "sub_title": output,
            "icon": `https://kore.ai/uploads/banking-home.png`,
        }
    ]
};
print(JSON.stringify(message));
```

### Widgets Configuration

You can configure the following widget types:

#### Dialog Task Widgets

We'll be creating two Widgets to trigger a Dialog Task.

**Current Account:**

First, let's see how to configure a Widget to display balance from the current account of the user with the steps below:

1. Navigate to **Automation AI > Use Cases > Digital Skills > Digital Views**.

2. Click the **Create Widget** button.

3. Give a Widget Name and a Display Name.

4. Set the **Source**, we're triggering Dialog Task, hence select *Dialog Task*.
   * **Select Dialog Task** as *Get Balance*, as per our use case.
   * In the **Entity Assignment**, set the following entities (you can select from the drop box that appears as you type) as per the Dialog Task requirement:

     * **AccountType** to *current;*
     * **AccountNumber** to *1*.

     You can use the **Open Dialog Task** icon, next to the select Dialog Task drop down, to open the dialog and check the entities needed.

     <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/open-dialog-task.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=a839490381c18d8cbd9cf6926022edae" alt="open dialog task" width="523" height="1014" data-path="ai-for-service/automation/digital-skills/images/open-dialog-task.png" />

5. **Save** the widget.

6. **Edit** the widget and click **Run & Preview** to see the widget output.

7. **Save as preview** will set the output as the thumbnail against the widget.

**Savings Account**

Repeat the above steps for Account View from *savings* account of the same account number.

<img src="https://mintcdn.com/koreai/PGJcv6R9Fdn8ZDgm/ai-for-service/automation/digital-skills/images/account-view.png?fit=max&auto=format&n=PGJcv6R9Fdn8ZDgm&q=85&s=6d708c7b28e5c9229e7a39ae3d68e143" alt="account view" width="809" height="593" data-path="ai-for-service/automation/digital-skills/images/account-view.png" />

### Panel Configuration

The Widgets thus created need to be attached to a Panel for runtime display and execution.

1. Click the **Create Panel** button to create a Panel.

2. In the **New Panel** window, enter Panel Name, Display Name and a URL for Icon.

   <img src="https://mintcdn.com/koreai/PGJcv6R9Fdn8ZDgm/ai-for-service/automation/digital-skills/images/add-panel-name.png?fit=max&auto=format&n=PGJcv6R9Fdn8ZDgm&q=85&s=200bcb232a5b9315898d69b9c58c3e99" alt="add panel name" width="945" height="902" data-path="ai-for-service/automation/digital-skills/images/add-panel-name.png" />

3. Click the **Add Widget** button to open the **Panel Management** window.

   <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/panel-management.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=69b37a1312259e8bd5ee475652fea6f8" alt="Panel Management - Add Widget" width="803" height="484" data-path="ai-for-service/automation/digital-skills/images/panel-management.png" />

4. Use the **Add Widget** to select and add the Widgets that we want to display, in this case Account Balance and Current Account widgets.

   <img src="https://mintcdn.com/koreai/PGJcv6R9Fdn8ZDgm/ai-for-service/automation/digital-skills/images/add-widget-to-panel.png?fit=max&auto=format&n=PGJcv6R9Fdn8ZDgm&q=85&s=814f9b017eafeb0c8006c182b7c450d3" alt="add widget to panel" width="947" height="363" data-path="ai-for-service/automation/digital-skills/images/add-widget-to-panel.png" />

5. Click the 3-dot menu icon on the panel, and select the **Test** option from the menu to see the widgets in action.

   <img src="https://mintcdn.com/koreai/mE3LlfGB-BrPXnHZ/ai-for-service/automation/digital-skills/images/test-widget.png?fit=max&auto=format&n=mE3LlfGB-BrPXnHZ&q=85&s=683c5d1551a1372c38f654117d0e06a5" alt="test widget" width="568" height="720" data-path="ai-for-service/automation/digital-skills/images/test-widget.png" />

### Panel with JSON Widgets

We'll see how to create Widgets with static JSON content. We'll use a JSON to display a pie chart.

1. Click **Create Panel** to create a new panel and name it **JSON Example**.

2. Use the **3-dot** icon and select **Panel Management** from the menu, there you'll find the option to **Add Widget**. Click on that.

   <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/panel-3-dot-menu.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=9fec2e9569d0fba575241fb6db51bf70" alt="3-dot menu for the new panel" width="793" height="390" data-path="ai-for-service/automation/digital-skills/images/panel-3-dot-menu.png" />

   <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/new-widget-json.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=68ed0d130600f812cbc2c1d270f4bf09" alt="New widget - JSON" width="578" height="903" data-path="ai-for-service/automation/digital-skills/images/new-widget-json.png" />

3. Enter the following in the JavaScript Editor. This is a message template to display a pie chart with a break up for amounts spent under various heads like travel, food, and accommodation. For more on supported message templates, [refer here](/ai-for-service/sdk/widget-sdk-message-formatting-and-templates).

   ```
   var message =
   {
     "templateType": "piechart",
     "pie_type": "regular",
     "title": "Summary",
     "description": "monthly report",
     "elements": [
       {
         "title": "Airlines",
         "value": "1264.0",
         "displayValue": "$ 1,234"
       },
       {
         "title": "Hotels",
         "value": "568.10",
         "displayValue": "$ 568"
       },
       {
         "title": "Food",
         "value": "324.50",
         "displayValue": "$ 324"
       }
     ]
   };
   print(JSON.stringify(message));
   ```

4. Save the new widget.

5. Click on **Create Panel** to create a new panel and name it *JSON Example*.

6. Click the **3-dot menu** icon on the panel. Select the **Add Widget** or **Panel Management** option and add the above created *Pie Chart* widget.

   <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/panel-3-dot-menu.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=9fec2e9569d0fba575241fb6db51bf70" alt="Add widget to panel" width="793" height="390" data-path="ai-for-service/automation/digital-skills/images/panel-3-dot-menu.png" />

7. **Test** the panel and you'll see the panel icons, click on each to see the widgets within them in action.

   <img src="https://mintcdn.com/koreai/mE3LlfGB-BrPXnHZ/ai-for-service/automation/digital-skills/images/test-panel.png?fit=max&auto=format&n=mE3LlfGB-BrPXnHZ&q=85&s=6cacfd483148393f5eb312a80cd6d296" alt="test panel" width="568" height="349" data-path="ai-for-service/automation/digital-skills/images/test-panel.png" />

## Publish

To publish the App first enable channels:

1. From left navigation menu, select **Channel** for publishing. For our use case we'll select both Web/Mobile Client and Widget SDK channels.
2. Select the channels and from **Configurations** tab, make a note of the **Bot Name**, **Bot Id**, **Client Id** and **Client Secret**.
3. From left navigation menu, select **Publish** option. Under Tasks & languages section, ensure that the Widget and Panels we developed are selected for publication.
4. **Proceed** with the Publish.

## Hosting

We'll be hosting the Panels in the web/mobile client. Click [here](/ai-for-service/app-settings/dev-tools/kore-ai-web-sdk) for more details on the Widget SDK usage.

1. Download the Kore.ai Widget SDK, go to this [link](https://github.com/Koredotcom/web-kore-sdk), and then click **Download**.

2. Extract all files to the *…/SDKApp/sdk* folder.

3. Open the above SDK folder, and traverse to *UI* folder.

4. Open the `kore-config.js`

5. Configure your `botOptions` with the ‘*web/mobile client*’ channel configurations copied  in  above  section.

   * `botOptions.botInfo`
   * `botOptions.clientId`
   * `botOptions.clientSecret`

6. Make other changes as per your requirements.

   <img src="https://mintcdn.com/koreai/PGJcv6R9Fdn8ZDgm/ai-for-service/automation/digital-skills/images/configure-bot-actions.png?fit=max&auto=format&n=PGJcv6R9Fdn8ZDgm&q=85&s=a1442aac9c6d38e8b09fdfdb6dc0acfd" alt="configure bot actions" width="1137" height="392" data-path="ai-for-service/automation/digital-skills/images/configure-bot-actions.png" />

7. Open the `kore-widgets-config.js`

8. Configure your `botOptionsWiz` with the ‘*Widget SDK*’ channel configurations copied  in  above  section.

   * `botOptionsWiz.botInfo`
   * `botOptionsWiz.clientId`
   * `botOptionsWiz.clientSecret`

9. Make other changes as per your requirements.

   <img src="https://mintcdn.com/koreai/PGJcv6R9Fdn8ZDgm/ai-for-service/automation/digital-skills/images/configure-bot-actions-2.png?fit=max&auto=format&n=PGJcv6R9Fdn8ZDgm&q=85&s=6164e6dfe0d6d43247484686825e72da" alt="configure bot actions" width="1093" height="332" data-path="ai-for-service/automation/digital-skills/images/configure-bot-actions-2.png" />

10. Open the `index_widgets_chat.html` file in the browser and see the chat window along with the widgets.

    <img src="https://mintcdn.com/koreai/b2hpE_JF8eqscS1x/ai-for-service/automation/digital-skills/images/open-index-widget-chat.png?fit=max&auto=format&n=b2hpE_JF8eqscS1x&q=85&s=e5c33c65b97867f53433380574fdc86d" alt="open index widget chart" width="1366" height="768" data-path="ai-for-service/automation/digital-skills/images/open-index-widget-chat.png" />

11. If you want to host the Panels individually use the `index_widgets.html` file. See the GitHub for hosting the same in your web site.
