본 방법에서는 고객의 계좌 관련 데이터가 데이터 테이블에 저장되는 뱅킹 봇 시나리오를 살펴보겠습니다. 사용자로부터 수집한 필수 정보를 어떻게 저장할 수 있는지 살펴보겠습니다. 데이터 테이블의 정의 및 Kore.ai 봇 플랫폼에서 데이터 테이블을 구현하는 방법에 대한 자세한 내용은 여기를 참조하세요.

문제 설명

뱅킹 봇을 예로 들면. 특정 고객의 경우 다음과 같은 데이터가 저장되어야 합니다:

  1. ID,
  2. 이름,
  3. 이메일 ID,
  4. 주소,
  5. 유형

전제 조건

  • 봇 구축 지식,
  • 은행 봇.

설정

다음 시나리오를 각각 하나씩 살펴보겠습니다.

  1. 위의 요건으로 데이터 테이블 정의
  2. 다음을 위한 대화 작업:
    1. 필요한 정보 수집,
    2. 서비스를 호출하여 고객 정보를 업데이트합니다.

데이터 테이블 설정

다음 정보를 보관할 데이터 테이블을 만듭니다:

  • CustId – 고객의 고유 식별자
  • CustName – 고객의 이름
  • CustEmail – 고객의 이메일 ID
  • CustType – 고객 유형 – 정기, 선호 등.
  • Address – 고객 주소

테이블 생성

  1. Kore.ai 봇 빌더 플랫폼에 로그인합니다.
  2. 데이터 탭을 선택합니다.
  3. 새 테이블 버튼을 클릭합니다.
  4. 새 테이블 페이지에서 다음을 입력합니다:
    1. 이름(예: customertable)
    2. 설명(예: 고객 세부 정보를 포함한 테이블)
  5. 섹션에서 다음 세부 정보를 추가합니다:
    열 이름 유형 필수 추가 설정
    CustId 숫자 암호화됨 및 최대 길이 5
    CustName 문자열
    Address 문자열 아니요
    CustType 문자열 아니요 기본값(선호)
    CustEmail 문자열 아니요

  6. 색인 섹션에서 CustId가 고유하도록 색인을 추가합니다.
  7. 생성을 클릭하면 테이블이 준비됩니다.
  8. 할당에서 이 테이블이 사용될 봇을 추가하고(예: 뱅킹 봇) 읽기, 쓰기삭제 권한을 부여합니다. 데이터를 삭제하지 않을 것이므로 삭제 권한은 선택 사항입니다.

대화 작업 설정

필요한 정보를 수집하기 위한 대화 작업을 생성하고 서비스 노드를 사용하여 데이터 테이블을 수집된 값으로 업데이트합니다.

대화 작업 생성

  1. 왼쪽 탐색 메뉴에서 봇 작업 -> 대화 작업을 선택합니다.
  2. 대화 작업에서 +를 클릭하여 새 작업 생성
    • IntentName 입력 (예: AddCustomer)
    • 생성 및 진행하여 대화 빌더 페이지를 엽니다
  3. 의도 노드 기본 설정을 유지하고 의도 노드를 닫습니다.
  4. 의도 노드 옆의 +를 클릭하고 다음과 같은 4개의 엔티티를 추가합니다:
    엔티티 이름 유형 사용자 프롬프트
    CustName 문자열 이름 입력
    CustEmail 이메일 이메일 ID 입력
    CustAddress 도시 주소 도시 입력
    CustType 항목 목록(열거됨) 소득 범위 선택

    CustType은 고객의 소득 수준에 따라 베이직, 선호 또는 프리미엄이 될 수 있습니다. 이를 위해 다음과 같이 스태틱 목록을 사용하여 CustType 값을 입력합니다.

  5. CustID를 생성하려면 테이블에서 마지막 고객 ID를 얻고 여기에 하나를 추가해야 합니다. 이를 위해 먼저 테이블에서 데이터를 가져온 다음 스크립트 노드를 사용하여 ID를 처리합니다.

데이터 가져오기

서비스 호출을 사용하여 테이블에서 데이터를 가져올 수 있습니다:

  1. 마지막 엔티티 노드에 대해 +를 클릭합니다.
  2. 서비스 -> 새 서비스 노드 옵션을 선택합니다.
  3. 일반 설정 섹션에서 다음을 설정합니다:
    • 이름(예: GetLastCustId)
    • 표시 이름(예: 고객 데이터 가져오기)
    • 서비스 유형 데이터 서비스 선택
    • 유형 테이블 선택
  4. 요청 정의에서 요청 추가를 클릭하여 테이블에서 데이터를 가져올 요청을 정의합니다.
  5. 데이터 서비스 요청 정의 페이지에서 다음을 입력합니다:
      • 테이블 이름 선택사용자 지정 가능으로 선택합니다
      • 데이터 가져오기조치
  6. 정의를 테스트저장하고 서비스 노드를 닫습니다.
  7. 다음 스크립트를 사용하여 다음 고객 ID에 대한 값을 얻기 위해 데이터 서비스에서 가져온 값을 처리하는 스크립트 노드를 추가합니다.
    var resultSet = context.GetLastCustId.response.body.queryResult; var id = 0; if (!resultSet.length) { id=1; } else { for (var i=0; i<resultSet.length; i++) { if (id < resultSet[i].CustId) { id = resultSet[i].CustId; } } id++; } context.lastID = id;
  8. 이제 테이블에 추가될 모든 데이터가 있습니다.

데이터 추가

서비스 호출을 사용하여 테이블에서 데이터를 추가할 수 있습니다:

  1. 위에 추가된 마지막 엔티티 노드에 대해 + 를 클릭합니다.
  2. 서비스 -> 새 서비스 노드 옵션을 선택합니다.
  3. 일반 설정 섹션에서 다음을 설정합니다:
    • 이름(예: AddCustData)
    • 표시 이름(예: 고객 데이터 추가)
    • 서비스 유형 데이터 서비스 선택
    • 유형 테이블 선택
  4. 요청 정의에서 요청 추가를 클릭하여 테이블에 데이터를 추가할 요청을 정의합니다.
  5. 데이터 서비스 요청 정의 페이지에서 다음을 입력합니다:
    • 테이블 이름 선택을 이전에 정의된 사용자 지정 가능으로 선택합니다.
    • 데이터 추가조치
    • 다음과 같이 정의된 엔티티에서 값 할당을 합니다:
      엔티티 컨텍스트
      CustName {{context.entities.CustName}}
      CustEmail {{context.entities.CustEmail}}
      Address {{context.entities.CustAddress}}
      CustType {{context.entities.CustType}}
      CustId {{context.lastID}}

  6. 메시지 노드를 추가하여 다음 응답 형식을 사용하여 추가된 값을 표시합니다: 'Customer account created for: {{context.GetCustData.response.body.queryResult[0].CustName}}, {{context.GetCustData.response.body.queryResult[0].CustEmail}}, {{context.GetCustData.response.body.queryResult[0].CustAddress}}, {{context.GetCustData.response.body.queryResult[0].CustType}}'
  7. 봇과 대화 옵션을 사용하여 메시지가 표시되면 값을 입력하고 메시지가 표시되는지 확인합니다.

결론

이 게시물에서 다음을 살펴보았습니다:

  • 데이터 테이블을 생성하는 방법,
  • 테이블에 열 추가,
  • 서비스 노드를 사용하여 테이블에서 데이터를 가져오고 이를 추가 처리에 사용하는 방법,
  • 서비스 노드를 사용하여 대화 작업에서 테이블로 데이터를 추가하는 방법,

다음 단계

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

このハウツーでは、顧客の口座関連データが保存されるデータテーブルのバンキングBotのシナリオを調査します。ユーザーから収集された必須情報を保存できる方法を確認します。データテーブルおよびKore.ai Botプラットフォームでどのように導入されているかの詳細については、こちらを参照してください

例題

以下のデータを保存する必要がある指定顧客のバンキングBotを考えてください。

  1. ID
  2. 名前
  3. メールID
  4. アドレス、および
  5. タイプ

Pre-requisites

  • Botビルドナレッジ
  • バンキングBot

設定

次の各シナリオを1つずつ考えてみましょう。

  1. 上記の要件でのデータテーブルの定義
  2. ダイアログタスク:
    1. 必須情報の収集、および
    2. サービスを呼び出し、顧客情報を更新

データテーブル設定

以下の情報を保持するデータテーブルを作成します。

  • CustId – 顧客の一意の識別子
  • CustName – 顧客名
  • CustEmail – 顧客のメールID
  • CustType – 顧客のタイプ – 通常、推奨など
  • アドレス – 顧客のアドレス

テーブル作成

  1. Kore.ai Botビルダープラットフォームにログインします。
  2. データタブを選択します。
  3. 新しいテーブルボタンをクリックします。
  4. 新しいテーブルページに、以下を入力します。
    1. 名前、たとえばcustomertable
    2. 説明、たとえば 顧客詳細を含むテーブル
  5. セクションに、以下の詳細を追加します。
    列名 タイプ 必須 追加設定
    CustId あり 暗号化および最大長5
    CustName 文字列 あり
    アドレス 文字列 なし
    CustType 文字列 なし 推奨としてのデフォルト値
    CustEmail 文字列 なし

  6. インデックスセクションに、 CustIdのインデックスを一意に追加します。
  7. 作成をクリックすると、テーブルが準備できます。
  8. Bot割当に、このテーブル、たとえばバンキングBotを使用するBotを追加し、 読み取り書き込みおよび削除権を付与します。データは削除しないため、削除権はオプションです。

ダイアログタスクの設定

必須情報を収集するダイアログタスクを作成し、サービスノードを使用して収集した値でデータテーブルを更新します。

ダイアログタスクの作成

  1. 左のナビゲーションメニューからBotタスク -> ダイアログタスクを選択します。
  2. ダイアログタスクに対して+をクリックして、新しいタスクを作成します。
    • IntentName、たとえばAddCustomerを入力します。
    • 作成および続行して、ダイアログビルダーページを開きます。
  3. インテントノードのデフォルト設定を保持し、インテントノードを閉じます。
  4. インテントノードの隣の+をクリックし、以下のように4つのエンティティを追加します。
    エンティティ名 タイプ ユーザープロンプト
    CustName 文字列 名前を入力
    CustEmail メール メールIDを入力
    CustAddress 市内 市内住所を入力
    CustType 項目リスト(列挙) 所得範囲を選択

    CustTypeは、顧客の所得レベルに基づき、基本、推奨またはプレミアムにできます。この目的のために、静的リストを使用して、以下のようにCustType値を入力しました。

  5. CustIDを生成するために、テーブルの最後の顧客IDを取得し、追加する必要があります。このため、まずテーブルからデータを取得し、スクリプトノードを使用してIDを処理します。

データの取得

サービスコールを使用して、テーブルからデータを取得できます。

  1. 最後のエンティティノードに対して、+をクリックします。
  2. サービス -> 新しいサービスノード オプションを選択します。
  3. 基本設定セクションから、以下を設定します。
    • 名前、たとえばGetLastCustId
    • 表示名、たとえば顧客データ取得
    • サービスタイプで、データサービスを選択
    • タイプで、テーブルを選択
  4. 要求定義で、要求を追加をクリックして要求を定義し、テーブルからデータを取得します。
  5. データサービス要求定義ページに、以下を入力します。
      • 顧客テーブルとしての テーブル名の選択
      • データ取得としてのアクション
  6. 定義をテストおよび保存し、サービスノードを 終了します
  7. スクリプトノードを追加して、データサービスから取得した値を処理し、以下のスクリプトを使用して次の顧客IDの値を取得します。
    var resultSet = context.GetLastCustId.response.body.queryResult; var id = 0; if (!resultSet.length) { id=1; } else { for (var i=0; i<resultSet.length; i++) { if (id < resultSet[i].CustId) { id = resultSet[i].CustId; } } id++; } context.lastID = id;
  8. これでテーブルに追加するすべての必須データがあります。

データの追加

サービスコールを使用して、テーブルにデータを追加します。

  1. 上で追加した最後のエンティティノードに対して、+ をクリックします。
  2. サービス -> 新しいサービスノード オプションを選択します。
  3. 基本設定セクションから、以下を設定します。
    • 名前、たとえばAddCustData
    • 表示名、たとえば顧客データ追加
    • サービスタイプで、データサービスを選択
    • タイプで、テーブルを選択
  4. 要求定義で、要求を追加をクリックして要求を定義し、テーブルへデータを追加します。
  5. データサービス要求定義ページに、以下を入力します。
    • 前に定義した顧客テーブルとしての テーブル名の選択
    • データ追加としてのアクション
    • 以下のように定義したエンティティから値を割り当てます。
      エンティティコンテキスト
      CustName {{context.entities.CustName}}
      CustEmail {{context.entities.CustEmail}}
      アドレス {{context.entities.CustAddress}}
      CustType {{context.entities.CustType}}
      CustId {{context.lastID}}

  6. メッセージノードを追加し、以下の応答フォーマットを使用して追加した値を表示します。 'Customer account created for: {{context.GetCustData.response.body.queryResult[0].CustName}}, {{context.GetCustData.response.body.queryResult[0].CustEmail}}, {{context.GetCustData.response.body.queryResult[0].CustAddress}}, {{context.GetCustData.response.body.queryResult[0].CustType}}'
  7. Botとの会話オプションを使用して、プロンプト表示されたら値を入力し、表示されるメッセージを確認します。

結論

この投稿では、以下を確認しました。

  • データテーブルの作成方法
  • テーブルへの列の追加
  • サービスノードを使用してテーブルからのデータの取得方法、およびそれを使用して追加処理する方法
  • サービスノードを使用してダイアログタスクからテーブルへデータを追加する方法

次のステップ

  • データテーブルを更新する方法に関するステップについては、こちらをクリックしてください。
  • デジタルフォームから取得したデータの追加方法に関するステップについては、こちらをクリックしてください。

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

In this How-To, we will explore a scenario in a Banking Bot, where the account-related data for a customer is stored in a Data Table. We will see how the required information gathered from the user can be stored.

For details on what Data Tables are and how it is implemented in the Kore.ai Bots platform, refer here.

Problem Statement

Consider a Banking Bot, for a given customer, the following data needs to be stored:

  1. Id;
  2. Name;
  3. Email id;
  4. Address; and
  5. Type

Pre-requisites

  • Bot building knowledge;
  • A Banking Bot.

Configurations

Let us consider each of the following scenarios one by one:

  1. Define Data Table with the above requirements;
  2. Dialog Task to:
    1. gather required information; and
    2. invoke a service to update the customer information.

Data Table Configuration

Create a Data Table to hold the following information:

  • CustId – A unique identifier for a customer;
  • CustName – Name of the customer;
  • CustEmail – Email id of the customer;
  • CustType – Type of customer – Regular, Preferred, etc.
  • Address – Customer Address;

Table Creation

  1. Log in to the Kore.ai Bot Builder platform.
  2. Select the Data tab.
  3. Click the New Table button.
  4. In the New Table page enter the following:
    1. Name, say customertable;
    2. Description, say Table containing customer details;
  5. Under the Column section add the following details:
    Column Name Type Required Additional Settings
    CustId number Yes Encrypted & Max Length of 5
    CustName string Yes
    Address string No
    CustType string No Default Value as Preferred
    CustEmail string No

  6. Under the Indexes section add an index for CustId to be unique.
  7. Click Create and your table is ready.
  8. Under the Bot Assignments add the bot which would be using this table, say Banking Bot, and give Read, Write and Delete permissions. Deletepermission is optional since we would not be deleting data.

Dialog Task Configuration

We will be creating a dialog task to gather the required information, and use a Service node to update the data table with the values thus gathered.

Create Dialog Task

  1. From the left navigation menu, select Bot Tasks -> Dialog Tasks.
  2. Click the + against the Dialog Tasks to create a new Task
    • Enter IntentName, say, AddCustomer
    • Create & Proceed to open the dialog builder page.
  3. Retain the Intent Node default settings, and close the Intent Node.
  4. Click the + next to the intent node and add four Entities as follows:
    Entity Name Type User Prompts
    CustName String Enter your name
    CustEmail Email Enter your email id
    CustAddress City Enter your address city
    CustType List of items (enumerated) Select your income range

    CustType can be Basic, Preferred, or Premium based on the income level of the customer. For this purpose, we have used a static list to populate the CustType value as follows:

  5. For generating the CustID, we need to get the last customer id in the table and add one to it. For this, we will first fetch data from the table and then use a Script node to process the id.

Fetch Data

You can use a Service call to fetch data from the table:

  1. Click the + against the last entity node.
  2. Select Service -> New Service Node option.
  3. From the General Settings section configure the following:
    • Name say GetLastCustId
    • Display Name say Get Customer Data
    • Service Type select Data Service
    • Type select Table
  4. Under Request Definition click Add Request to define a request to fetch data from the table.
  5. In the Data Service Request Definition page, enter the following:
      • Choose Table Name as customertable
      • Actions as Get Data
  6. Test and Save the definition and close the service node.
  7. Add a Script node to process the values fetched from the data service to obtain the value for the next customer id using the following script:
    var resultSet = context.GetLastCustId.response.body.queryResult;
    var id = 0;
    
    if (!resultSet.length) {
        id=1;
    } else {
        for (var i=0; i<resultSet.length; i++) {
            if (id < resultSet[i].CustId) {
                id = resultSet[i].CustId;
             }
            }
        id++;    
        }
    context.lastID = id;
  8. Now we have all the required data to add to the table.

Add Data

We will be using a Service call to add data to the table:

  1. Click the + against the last Entity node added above.
  2. Select Service -> New Service Node option.
  3. From the General Settings section configure the following:
    • Name say AddCustData
    • Display Name say Add Customer Data
    • Service Type select Data Service
    • Type select Table
  4. Under Request Definition click Add Request to define a request to add data to the table.
  5. In the Data Service Request Definition page, enter the following:
    • Choose Table Name as customertable defined earlier
    • Actions as Add Data
    • Assign Values from the entities defined as follows:
      Column Entity context
      CustName {{context.entities.CustName}}
      CustEmail {{context.entities.CustEmail}}
      Address {{context.entities.CustAddress}}
      CustType {{context.entities.CustType}}
      CustId {{context.lastID}}

  6. Add a Message node to display the values added using the following response format:
    'Customer account created for: {{context.GetCustData.response.body.queryResult[0].CustName}}, {{context.GetCustData.response.body.queryResult[0].CustEmail}}, {{context.GetCustData.response.body.queryResult[0].CustAddress}}, {{context.GetCustData.response.body.queryResult[0].CustType}}'
  7. Using Talk to bot option, enter the values when prompted and see the message being displayed.

Conclusion

In this post, we have seen:

  • How to create a Data Table;
  • Add columns to the Table;
  • How to fetch the data from the table using a service node and use it for further processing;
  • How to add data to the table from the Dialog task using a service node;

Next Steps

  • Click here for steps on how to update the data table.
  • Click here for steps on how to add data obtained from the digital forms.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed