시작
Kore.ai 대화형 플랫폼
챗봇 개요
자연어 처리(NLP)
봇 개념 및 용어들
빠른 시작 가이드
봇 빌더 접근 방법
사용 고지 사항 (영어)
Kore.ai 봇 빌더로 작업하기
봇 구축 시작하기
릴리스 정보
현재 버전 (영어)
이전 버전 (영어)

개념
디자인
스토리보드
대화 작업
개요
Using the Dialog Builder Tool
노드 유형
사용자 의도 노드
대화 노드
엔티티 노드
양식 노드
확인 노드
서비스 노드
봇 조치 노드
Service Node
WebHook 노드
스크립트 노드
노드 그룹화하기
Agent Transfer Node
사용자 프롬프트
음성 통화 속성
대화 관리
노드 및 전환
구성 요소 전환
컨텍스트 개체
이벤트 기반 봇 조치
지식 그래프
소개
지식 추출
지식 그래프 생성
봇에 지식 그래프 추가
그래프 생성
지식 그래프 작성
FAQ 추가
작업 실행
기존 소스에서 FAQ 구축
특성, 동의어 및 불용어
변수 네임스페이스 관리
수정
용어 편집 및 삭제
용어 편집 및 삭제
질문과 응답 편집
Knowledge Graph Training
지식 그래프 분석
봇 온톨로지 가져오기 및 내보내기
지식 그래프 가져오기
지식 그래프 내보내기
지식 그래프 생성
CSV 파일에서
JSON 파일
지식 그래프 생성
경고 작업
스몰 토크
Digital Skills
디지털 양식
Views
Digital Views
Panels
Widgets
기차
봇 성능 향상 – NLP 최적화
기계 학습
소개
모델 검증
기초 의미
지식 그래프 학습
특성
순위 및 해결
고급 NLP 설정
NLP 설정 및 지침
봇 인텔리전스
소개
컨텍스트 관리
컨텍스트 관리
대화 관리
다중 – 의도 탐지
엔티티 수정
기본 대화
정서 관리
어조 분석
Test & Debug
봇과 대화
발화 테스트
배치 테스트하기
대화 테스트
배포
채널 활성화
봇 게시
분석
봇 분석하기
Conversations Dashboard
Performance Dashboard
사용자 정의 대시보드
소개
맞춤형 메타 태그
사용자 정의 대시보드 생성 방법
Conversation Flows
NLP 지표
Containment Metrics
사용량 지표
스마트 봇
소개
범용 봇
소개
범용 봇 정의
범용 봇 생성
범용 봇 학습
범용 봇 커스터마이징
범용 봇용 추가 언어 활성화
스토어
Manage Assistant
플랜 및 사용량
Overview
Usage Plans
Support Plans
플랜 관리
봇 인증
다국어 봇
개인 식별 정보 삭제하기
봇 변수 사용
IVR 통합
일반 설정
봇 관리

방법
간단한 봇 생성하기
Design Conversation Skills
뱅킹 봇 생성
뱅킹 봇 – 자금 이체
뱅킹 봇 – 잔액 업데이트
Knowledge Graph (KG) 구축
스마트 경고를 예약하는 방법
Design Digital Skills
디지털 양식 설정 방법
디지털 보기 설정 방법
데이터 테이블에 데이터를 추가하는 방법
데이터 테이블 내 데이터 업데이트 방법
UI 양식에서 데이터 테이블에 데이터를 추가하는 방법
Train the Assistant
특성 사용 방법
의도와 엔티티에 대한 패턴 사용 방법
컨텍스트 전환 관리 방법
Deploy the Assistant
상담사 전환을 설정하는 방법
봇 기능 사용 방법
콘텐츠 변수 사용 방법
전역 변수 사용 방법
Kore.ai 웹 SDK 튜토리얼
Kore.ai 위젯 SDK 튜토리얼
Analyze the Assistant
사용자 정의 대시보드 생성 방법
사용자 지정 태그를 사용하여 봇 메트릭을 필터링하는 방법

API 및 SDK
API 참조
Kore.ai API 사용
API 목록
API 컬렉션
koreUtil Libraries
SDK 참조
상담사 전환을 설정하는 방법
봇 기능 사용 방법
콘텐츠 변수 사용 방법
전역 변수 사용 방법
소개
Kore.ai 웹 SDK 튜토리얼
Kore.ai 위젯 SDK 튜토리얼

관리
소개
봇 관리자 콘솔
대시보드
사용자 관리
사용자 관리
그룹 관리
역할 관리
봇 관리 모듈
등록
사용자 초대
사용자 등록을 위한 대량 초대 보내기
사용자 및 사용자 데이터 가져오기
Active Directory에서 사용자 동기화
보안 및 준수
싱글 사인 온 사용
보안 설정
Kore.ai 커넥터
봇 관리자용 분석
Billing (지원하지 않음)
  1. Docs
  2. Virtual Assistants
  3. How Tos
  4. Travel Planing Assistant
  5. Travel VA: Web SDK Tutorial

Travel VA: Web SDK Tutorial

This tutorial is an end-to-end walkthrough for setting up and running an instance of the Kore.ai assistants Web SDK which is a collection of libraries that you can use to integrate Kore.ai assistants with your own web applications.

Web SDK Tutorial Overview

In this tutorial, you will install a Kore.ai sample assistant, a test application to host the assistant, and then a JSON Web Token (JWT) generation web service using your local host server to communicate between the assistant on your local server and the Kore.ai XO Platform. The following list describes the general steps you will take to install and configure the Web SDK.

  1. Build the assistant to be integrated – For this tutorial, you will install the Travel Planning Sample assistant that uses open APIs to get flight and location information, along with weather reports.
  2. Configure Web/Mobile Client channel – To use the Travel Planning Sample Virtual Assistant with the Web SDK, you must configure the assistant for the Web/Mobile Client channel.
  3. Create a new Client App – When you configure the Web/Mobile Client channel for the Travel Planning Sample Virtual Assistant, you must create a client app and select the JWT signing algorithm used to generate the authentication tokens.
  4. Publish the assistant– After you have configured the Travel Planning Sample Virtual Assistant, you must publish the assistant which sends the bot to the Bots Admin for approval.
  5. Approve and Deploy the assistant– In the Bots Admin Console, the published assistant and tasks must be approved to deploy.
  6. Download and install Node.js – You will need to install Node.js used to host the JWT token generation web service for the Web SDK to communicate between the assistant in the test application and the Kore.ai XO Platform.
  7. Download and uncompress the test application –  The test application, SDKApp is used to simulate your application that will host the Kore.ai assistant as a channel on a web page using your computer local host server.
  8. Download and uncompress the Kore.ai Web SDK – The Web SDK contains the libraries used to communicate and run the assistant in the test application using the Web/Mobile Client channel. You will need to configure settings in the index.html file for your computer.
  9. Start your application and view the assistant in a web browser – In a Terminal window, you will start the JWT service, and then view the assistant in a web browser.

Now let us see detailed step by step implementation.

Installing and Running the Kore.ai Web SDK

This section provides detailed steps on how to run a Kore.ai Sample Virtual Assistant using the Web SDK and a test application running on your computer local host server. To get started, you will need to build a assistant to run in the test application, and then configure the assistant to run in the Web/Mobile Client channel. For this tutorial, we will be installing a sample assistant.

  1. Log in to XO Platform, and click the down-arrow next to the  +New Bot and select Install Sample Virtual Assistants.
  2. Hover over Travel Planning Sample, and then click Install.
  3. The Travel Planning Sample installed successfully message is displayed and the Sample Virtual Assistant is added to your Bots left-hand navigation menu.

In this next section, you will define the Web/Mobile Client channel for the Travel Planning Sample Virtual Assistant by creating a new client app and defining channel settings. See here for a detailed explanation of the steps.

  1. On the XO Platform top menu, select the Build tab.
  2. From the left menu, click Integrations > BotKit.
  3. In the Select App drop-down list, click Create App. The Create Client App dialog is displayed.
  4. In the Name field, enter a name for your app, for example, My SDK Client App.
  5. In the JWT Signing Algorithms section, select HS256 to generate the authentication tokens.
  6. Click Next -> Done.
  7. The Web/Mobile Client Channel page is displayed with the following JWT credentials, make a note of all these details:
    • Bot Name
    • Bot ID
    • Client ID
    • Client Secret
      We will be using them later in the Web SDK setup.
  8. Click Save.

Now that the assistant is created and defined for the Web/Mobile Client channel, you are ready to publish and deploy it.

Note: By default, the Travel Sample Planning assistant is configured with Target Audience set to Enterprise Users on the Build tab in the Configurations -> General Settings. Optionally, you can define this assistant for General Public use. Once this assistant is published, the Target Audience cannot be changed.
  1. On the Deploy tab, click Publish.
  2. On Publish page, select all tasks, and then click Proceed.
  3. Enter a comment and Confirm publish.

After an enterprise developer publishes a assistant, it must be approved and assigned to the users for use.

  1. Complete one of the following assistant deployments in the Bots Admin Console depending if your bot Target Audience is set to Enterprise Users or General Public. Complete one of the following:
    1. In the Bots Admin Console, in the Bots Management module, on the Enterprise Bots page, click the Ellipses  icon for the Travel Planning Sample Virtual Assistant that you want to deploy, and then click Manage bot tasks. The Manage Bot Tasks dialog is displayed.
    2. In the Bot tasks field, click the Expand BotsAdminExpandRight icon to display the available and deployed tasks, select all tasks for this bot, and then click Confirm.
    3. In the Manage bots tasks dialog, click Confirm. The Bot status changed successfully message is displayed.
    4. On the Enterprise Bots page, click the Ellipses icon for theTravel Planning Sample Virtual Assistant that you want to assign the users to, and then click Bot & task assignments.
    5. The Bot & task assignments dialog is displayed. Assign the assistant to your users, for all tasks, including yourself.

Now it is time to download, uncompress, install and configure the software packages required for the Web SDK and a test application to run the assistant locally on your local host server.

  1. To download and install node.js on your computer, go to https://nodejs.org/en/download/, and then select your OS as .pkg for Mac, and .msi for Windows.
  2. In a Terminal window, run the node -v command to verify installation and version, for example, v6.10.2.
  3. Locate the SDKApp/sdk folder of your web server hosting the app where you want to integrate the Kore assistant. For this tutorial, to download the test application and JWT web service, click SDKApp, and unzip it.
  4. To download the Kore.ai Web SDK, go to https://github.com/Koredotcom/web-kore-sdk, and then click Download. Extract all files to the …/SDKApp/sdk folder mentioned in step above. Check for the release compatibility from the release notes.
  5. From the XO Platform Web/Mobile Client Channel page on the Deploy -> Channels menu, copy the following (as mentioned in step 8 above):
    • clientSecret
    • clientId
    • Bot Name
  6. For ver7.2 of the platform, the Web SDK repo structure has undergone a major change. The steps would vary based on which repo you are using.
    • Follow this step for the latest Web SDK file downloaded after ver7.2 of the platform i.e. after Feb 2020.
      1. Open the index.html file from the …/SDKApp/sdk/UI folder using a text editor. Update the following lines to add the path to the UI folder:

        <script src="libs/jquery.js" type="text/javascript"></script>
        <script src="libs/jquery.tmpl.min.js" type="text/javascript"></script>
        <script src="libs/jquery-ui.min.js" type="text/javascript"></script>
        <link href="libs/jquery-ui.min.css" rel="stylesheet"></link>
        <script src="chatWindow.js" type="text/javascript"></script>
        <link href="chatWindow.css" rel="stylesheet"></link>

      2. Open the kore-config.js and update the botOptions parameters botInfo, clientId and clientSecret, and your email id as userIdentity.
        “clientSecret”: “{client secret}”
        $.ajax({
           url: “http://localhost:3000/api/users/getJWT”,
             //this is sample url of a localhost. 
             //This should include the url where you are hosting the bot.
           botOptions.userIdentity = ‘ ‘;
             // Provide users email id here
           botOptions.clientId= "{client id} ";
             // secure client-id
           _botOptions.botInfo= {name:"{bot name}","id":"{bot id"};
             // Kore bot name is case sensitive
         })

        The JWTUrl refers to the location where your app (where you want the Kore.ai assistant to be integrated) is hosted. For this tutorial, we are using the JWT server (as setup in step 19) and hence using the same here.

      3. Ensure that in kore-config.js you set the audience for your assistant. Choose one of the following:
        • "isAnonymous": < false >; if the assistant is deployed for the enterprise users, and then set botOptions.userIdentity = '< Your email ID >';        – or –
        • "isAnonymous": < true >; if bot is deployed for Consumer Use.
    • This step is valid for older Web SDK file downloaded before ver7.2 of the platform i.e. before Feb 2020.
      • Open the index.html file from the …/SDKApp/sdk/UI folder using a text editor:
        1. Update the following lines to add the path to the UI folder:

          <script src="libs/jquery.js" type="text/javascript"></script>
          <script src="libs/jquery.tmpl.min.js" type="text/javascript"></script>
          <script src="libs/jquery-ui.min.js" type="text/javascript"></script>
          <link href="libs/jquery-ui.min.css" rel="stylesheet"></link>
          <script src="chatWindow.js" type="text/javascript"></script>
          <link href="chatWindow.css" rel="stylesheet"></link>

        2. Update the following parameters to run as local host:
          “clientSecret”: “{client secret}”
          $.ajax({
            url: “http://localhost:3000/api/users/getJWT”,
               //this is sample url of a local host. 
               //This should include the url where you are hosting the bot.
            botOptions.userIdentity = ‘ ‘;
               // Provide users email id here
            botOptions.clientId= "{client id} ";
               // secure client-id
            _botOptions.botInfo= {name:"{bot name}","id":"{bot id"};
               // Kore bot name is case sensitive
           })

          Note: The URL mentioned in the above code snippet, refers to the location where your app (where you want the Kore.ai Bot to be integrated) is hosted. For this tutorial, we are using the JWT server (as setup i step 18) and hence using the same here.

        3. Choose one of the following:
          • "isAnonymous": < false >; if the assistant is deployed for the enterprise users, and then set botOptions.userIdentity = '< Your email ID >';        – or –
          • "isAnonymous": < true >; if the assistant is deployed for Consumer Use.
  7. Save your changes. You are ready to start the JWT token generation service and access the test application with the configured Web SDK in your local web browser.
  8. Go to home directorycd SDKApp.
  9. Install dependencies using the following command npm install.
  10. Start SDKApp node startServer.js.
  11. Access the application in any browser using localhost:3000.

Passing data via webSDK

You can pass additional information of the user accessing the channel by adding the custom data at botInfo inside the index.html file.

botOptions.botInfo = {name: "Banking Bot", 
                              "_id": "<bot_id>", 
                              customData: "value"
              };

Details like phone number, address, or location, etc., are examples of data that can be passed inside the customData. customData can be accessed from lastMessage under the BotUserSession of the context object. This data will be specific to the user using webSDK and will last for the user session. Multiple values can also be added to the customData in the index.html file as key-value pairs:

botOptions.botInfo = {name:"<bot_name>",
                      "_id":"<bot_id",
                      customData:{"name":"John",
                                  "age":30,
                                   "cars": {"car1":"Ford",
                                            "car2":"BMW",
                                            "car3":"Fiat"
                                             }
                                   }
                           };

Passing Mapped Identities

The Web/Mobile SDKs support the passing of mapped identities of the users when they switch from one identity to another while interacting with the assistant. This process allows the users to continue any ongoing conversation initiated using a previous identity. For example, a user may have started the conversation with the assistant using an anonymous or randomly generated identity. After exchanging a few messages, the user may become an authenticated or known user by logging into your website or any application. At this point, the user’s known identity can be passed to the bot from the SDK as part of the ‘JWT Grant API’ call using the parameter identityToMerge. The Platform uses this information to merge the user identities and allows the user to resume an ongoing conversation using the new known identity.

{
 "iat": 1611810186883,
 "exp": 1611813786.883,
 "aud": "https://idproxy.kore.com/authorize",
 "iss": "cs-d3042d3e-7da4-55da-a94d-783349270cc0",
 "sub": "knowuser1@test.com",
 "isAnonymous": "false",
 "identityToMerge": "anonymoususer1@test.com"
}

The following scenarios describe the bot behavior when dealing with the new identity and merged identity:

  • When both the new and merged identities are not present in the system, then the new identity is created and a new conversation is started using new identity.
  • When the new identity is present but the merged identity is not present in the system, then the conversation is started or continued (in case of an active session) using new identity.
  • When the merged identity is present but the new identity is not present in the system, then the new identity is created and the conversation is continued using the new identity. All references to the merged identity are replaced with the new identity and the merged identity is removed.
  • When both the merged identity and the new identity are present in the system and the new identity does not have an active session, then the conversation is continued using the new identity. All references to the merged identity are replaced with the new identity and the merged identity is removed.
  • When both the merged identity and the new identity are present in the system and both have an active session, then the merged identity’s conversation is continued using the new identity. All references to the merged identity are replaced with the new identity and the merged identity is removed. The active session of the new identity is marked as “Drop-off” and closed.

Due to the above-mentioned behavior in the user identity following changes can be seen:

  • Analytics and Chat History will be updated associating all the sessions related to the merged identity with the new identity.
  • The sessions data is updated replacing the merged identity with the new identity.
  • The Billing Session tracking merged identity’s conversation will be marked as new identity.

Custom Meta Tags via webSDK

With the release of ver8.0 of the platform, you can directly add Custom Meta Tags from all supported internal channels (Web SDK/IVR / IVRVoice / Webhook channels). You can define Session, User, and Message level meta-tags. These tags will be added to the Conversation Session as soon as it is created.

botOptions.botInfo = {name:"<bot_name>", "_id":"<bot_id",
                           customData :{"name":"John"},
                           "metaTags": { 
                                 "messageLevelTags": [{ "name": "tag1", value: "message"}],
                                 "sessionLevelTags": [{ "name": "tag2", value: "session"}],
                                 "userLevelTags": [{ "name": "tag3", value: "user"}]
                                 }  
                          };

Common errors

Some commonly encountered errors are:

  • A wrong URL is given in index.html, users see a 404 error. Double check the URL. URL changes depending on whether you are hosting the assistant on your own web SDK or on Kore’s web SDK. If its Kore web SDK, then the URL is http://demo.kore.net:3000/users/sts 7. If you are hosting on your in-house web SDK, then provide the respective URL.
  • missing/Invalid jwt.sub(): This error occurs for enterprise assistants, when the user’s email id is not given in the index.html file. Provide users identity as shown below in index.html botOptions.userIdentity = ‘x@gmail.com’;// Provide users email id here.
  • Not found: User sees this error when either wrong clientID or no clientID is given. Check the correct ClientID from Bot – API Extensions option botOptions.clientId = “{clientID}”; // secure client-id.
  • error verifying the jwt: the Wrong clientSecret is given in index.html: Check the correct clientSecret you get from Bot – API Extensions option “clientSecret”: "{clientSecret}” //provide clientSecret here.

After you install and test the Web SDK using the test application and your local host server, you can use the same concept to install and configure the Web SDK in your own enterprise application. You will just need to reconfigure the file paths and URLs in the index.html file of the Web SDK to point to your website and servers, and configure a Kore.ai assistant for the Web/Mobile Client channel with JWT credentials for your enterprise.

Travel VA: Web SDK Tutorial

This tutorial is an end-to-end walkthrough for setting up and running an instance of the Kore.ai assistants Web SDK which is a collection of libraries that you can use to integrate Kore.ai assistants with your own web applications.

Web SDK Tutorial Overview

In this tutorial, you will install a Kore.ai sample assistant, a test application to host the assistant, and then a JSON Web Token (JWT) generation web service using your local host server to communicate between the assistant on your local server and the Kore.ai XO Platform. The following list describes the general steps you will take to install and configure the Web SDK.

  1. Build the assistant to be integrated – For this tutorial, you will install the Travel Planning Sample assistant that uses open APIs to get flight and location information, along with weather reports.
  2. Configure Web/Mobile Client channel – To use the Travel Planning Sample Virtual Assistant with the Web SDK, you must configure the assistant for the Web/Mobile Client channel.
  3. Create a new Client App – When you configure the Web/Mobile Client channel for the Travel Planning Sample Virtual Assistant, you must create a client app and select the JWT signing algorithm used to generate the authentication tokens.
  4. Publish the assistant– After you have configured the Travel Planning Sample Virtual Assistant, you must publish the assistant which sends the bot to the Bots Admin for approval.
  5. Approve and Deploy the assistant– In the Bots Admin Console, the published assistant and tasks must be approved to deploy.
  6. Download and install Node.js – You will need to install Node.js used to host the JWT token generation web service for the Web SDK to communicate between the assistant in the test application and the Kore.ai XO Platform.
  7. Download and uncompress the test application –  The test application, SDKApp is used to simulate your application that will host the Kore.ai assistant as a channel on a web page using your computer local host server.
  8. Download and uncompress the Kore.ai Web SDK – The Web SDK contains the libraries used to communicate and run the assistant in the test application using the Web/Mobile Client channel. You will need to configure settings in the index.html file for your computer.
  9. Start your application and view the assistant in a web browser – In a Terminal window, you will start the JWT service, and then view the assistant in a web browser.

Now let us see detailed step by step implementation.

Installing and Running the Kore.ai Web SDK

This section provides detailed steps on how to run a Kore.ai Sample Virtual Assistant using the Web SDK and a test application running on your computer local host server. To get started, you will need to build a assistant to run in the test application, and then configure the assistant to run in the Web/Mobile Client channel. For this tutorial, we will be installing a sample assistant.

  1. Log in to XO Platform, and click the down-arrow next to the  +New Bot and select Install Sample Virtual Assistants.
  2. Hover over Travel Planning Sample, and then click Install.
  3. The Travel Planning Sample installed successfully message is displayed and the Sample Virtual Assistant is added to your Bots left-hand navigation menu.

In this next section, you will define the Web/Mobile Client channel for the Travel Planning Sample Virtual Assistant by creating a new client app and defining channel settings. See here for a detailed explanation of the steps.

  1. On the XO Platform top menu, select the Build tab.
  2. From the left menu, click Integrations > BotKit.
  3. In the Select App drop-down list, click Create App. The Create Client App dialog is displayed.
  4. In the Name field, enter a name for your app, for example, My SDK Client App.
  5. In the JWT Signing Algorithms section, select HS256 to generate the authentication tokens.
  6. Click Next -> Done.
  7. The Web/Mobile Client Channel page is displayed with the following JWT credentials, make a note of all these details:
    • Bot Name
    • Bot ID
    • Client ID
    • Client Secret
      We will be using them later in the Web SDK setup.
  8. Click Save.

Now that the assistant is created and defined for the Web/Mobile Client channel, you are ready to publish and deploy it.

Note: By default, the Travel Sample Planning assistant is configured with Target Audience set to Enterprise Users on the Build tab in the Configurations -> General Settings. Optionally, you can define this assistant for General Public use. Once this assistant is published, the Target Audience cannot be changed.
  1. On the Deploy tab, click Publish.
  2. On Publish page, select all tasks, and then click Proceed.
  3. Enter a comment and Confirm publish.

After an enterprise developer publishes a assistant, it must be approved and assigned to the users for use.

  1. Complete one of the following assistant deployments in the Bots Admin Console depending if your bot Target Audience is set to Enterprise Users or General Public. Complete one of the following:
    1. In the Bots Admin Console, in the Bots Management module, on the Enterprise Bots page, click the Ellipses  icon for the Travel Planning Sample Virtual Assistant that you want to deploy, and then click Manage bot tasks. The Manage Bot Tasks dialog is displayed.
    2. In the Bot tasks field, click the Expand BotsAdminExpandRight icon to display the available and deployed tasks, select all tasks for this bot, and then click Confirm.
    3. In the Manage bots tasks dialog, click Confirm. The Bot status changed successfully message is displayed.
    4. On the Enterprise Bots page, click the Ellipses icon for theTravel Planning Sample Virtual Assistant that you want to assign the users to, and then click Bot & task assignments.
    5. The Bot & task assignments dialog is displayed. Assign the assistant to your users, for all tasks, including yourself.

Now it is time to download, uncompress, install and configure the software packages required for the Web SDK and a test application to run the assistant locally on your local host server.

  1. To download and install node.js on your computer, go to https://nodejs.org/en/download/, and then select your OS as .pkg for Mac, and .msi for Windows.
  2. In a Terminal window, run the node -v command to verify installation and version, for example, v6.10.2.
  3. Locate the SDKApp/sdk folder of your web server hosting the app where you want to integrate the Kore assistant. For this tutorial, to download the test application and JWT web service, click SDKApp, and unzip it.
  4. To download the Kore.ai Web SDK, go to https://github.com/Koredotcom/web-kore-sdk, and then click Download. Extract all files to the …/SDKApp/sdk folder mentioned in step above. Check for the release compatibility from the release notes.
  5. From the XO Platform Web/Mobile Client Channel page on the Deploy -> Channels menu, copy the following (as mentioned in step 8 above):
    • clientSecret
    • clientId
    • Bot Name
  6. For ver7.2 of the platform, the Web SDK repo structure has undergone a major change. The steps would vary based on which repo you are using.
    • Follow this step for the latest Web SDK file downloaded after ver7.2 of the platform i.e. after Feb 2020.
      1. Open the index.html file from the …/SDKApp/sdk/UI folder using a text editor. Update the following lines to add the path to the UI folder:

        <script src="libs/jquery.js" type="text/javascript"></script>
        <script src="libs/jquery.tmpl.min.js" type="text/javascript"></script>
        <script src="libs/jquery-ui.min.js" type="text/javascript"></script>
        <link href="libs/jquery-ui.min.css" rel="stylesheet"></link>
        <script src="chatWindow.js" type="text/javascript"></script>
        <link href="chatWindow.css" rel="stylesheet"></link>

      2. Open the kore-config.js and update the botOptions parameters botInfo, clientId and clientSecret, and your email id as userIdentity.
        “clientSecret”: “{client secret}”
        $.ajax({
           url: “http://localhost:3000/api/users/getJWT”,
             //this is sample url of a localhost. 
             //This should include the url where you are hosting the bot.
           botOptions.userIdentity = ‘ ‘;
             // Provide users email id here
           botOptions.clientId= "{client id} ";
             // secure client-id
           _botOptions.botInfo= {name:"{bot name}","id":"{bot id"};
             // Kore bot name is case sensitive
         })

        The JWTUrl refers to the location where your app (where you want the Kore.ai assistant to be integrated) is hosted. For this tutorial, we are using the JWT server (as setup in step 19) and hence using the same here.

      3. Ensure that in kore-config.js you set the audience for your assistant. Choose one of the following:
        • "isAnonymous": < false >; if the assistant is deployed for the enterprise users, and then set botOptions.userIdentity = '< Your email ID >';        – or –
        • "isAnonymous": < true >; if bot is deployed for Consumer Use.
    • This step is valid for older Web SDK file downloaded before ver7.2 of the platform i.e. before Feb 2020.
      • Open the index.html file from the …/SDKApp/sdk/UI folder using a text editor:
        1. Update the following lines to add the path to the UI folder:

          <script src="libs/jquery.js" type="text/javascript"></script>
          <script src="libs/jquery.tmpl.min.js" type="text/javascript"></script>
          <script src="libs/jquery-ui.min.js" type="text/javascript"></script>
          <link href="libs/jquery-ui.min.css" rel="stylesheet"></link>
          <script src="chatWindow.js" type="text/javascript"></script>
          <link href="chatWindow.css" rel="stylesheet"></link>

        2. Update the following parameters to run as local host:
          “clientSecret”: “{client secret}”
          $.ajax({
            url: “http://localhost:3000/api/users/getJWT”,
               //this is sample url of a local host. 
               //This should include the url where you are hosting the bot.
            botOptions.userIdentity = ‘ ‘;
               // Provide users email id here
            botOptions.clientId= "{client id} ";
               // secure client-id
            _botOptions.botInfo= {name:"{bot name}","id":"{bot id"};
               // Kore bot name is case sensitive
           })

          Note: The URL mentioned in the above code snippet, refers to the location where your app (where you want the Kore.ai Bot to be integrated) is hosted. For this tutorial, we are using the JWT server (as setup i step 18) and hence using the same here.

        3. Choose one of the following:
          • "isAnonymous": < false >; if the assistant is deployed for the enterprise users, and then set botOptions.userIdentity = '< Your email ID >';        – or –
          • "isAnonymous": < true >; if the assistant is deployed for Consumer Use.
  7. Save your changes. You are ready to start the JWT token generation service and access the test application with the configured Web SDK in your local web browser.
  8. Go to home directorycd SDKApp.
  9. Install dependencies using the following command npm install.
  10. Start SDKApp node startServer.js.
  11. Access the application in any browser using localhost:3000.

Passing data via webSDK

You can pass additional information of the user accessing the channel by adding the custom data at botInfo inside the index.html file.

botOptions.botInfo = {name: "Banking Bot", 
                              "_id": "<bot_id>", 
                              customData: "value"
              };

Details like phone number, address, or location, etc., are examples of data that can be passed inside the customData. customData can be accessed from lastMessage under the BotUserSession of the context object. This data will be specific to the user using webSDK and will last for the user session. Multiple values can also be added to the customData in the index.html file as key-value pairs:

botOptions.botInfo = {name:"<bot_name>",
                      "_id":"<bot_id",
                      customData:{"name":"John",
                                  "age":30,
                                   "cars": {"car1":"Ford",
                                            "car2":"BMW",
                                            "car3":"Fiat"
                                             }
                                   }
                           };

Passing Mapped Identities

The Web/Mobile SDKs support the passing of mapped identities of the users when they switch from one identity to another while interacting with the assistant. This process allows the users to continue any ongoing conversation initiated using a previous identity. For example, a user may have started the conversation with the assistant using an anonymous or randomly generated identity. After exchanging a few messages, the user may become an authenticated or known user by logging into your website or any application. At this point, the user’s known identity can be passed to the bot from the SDK as part of the ‘JWT Grant API’ call using the parameter identityToMerge. The Platform uses this information to merge the user identities and allows the user to resume an ongoing conversation using the new known identity.

{
 "iat": 1611810186883,
 "exp": 1611813786.883,
 "aud": "https://idproxy.kore.com/authorize",
 "iss": "cs-d3042d3e-7da4-55da-a94d-783349270cc0",
 "sub": "knowuser1@test.com",
 "isAnonymous": "false",
 "identityToMerge": "anonymoususer1@test.com"
}

The following scenarios describe the bot behavior when dealing with the new identity and merged identity:

  • When both the new and merged identities are not present in the system, then the new identity is created and a new conversation is started using new identity.
  • When the new identity is present but the merged identity is not present in the system, then the conversation is started or continued (in case of an active session) using new identity.
  • When the merged identity is present but the new identity is not present in the system, then the new identity is created and the conversation is continued using the new identity. All references to the merged identity are replaced with the new identity and the merged identity is removed.
  • When both the merged identity and the new identity are present in the system and the new identity does not have an active session, then the conversation is continued using the new identity. All references to the merged identity are replaced with the new identity and the merged identity is removed.
  • When both the merged identity and the new identity are present in the system and both have an active session, then the merged identity’s conversation is continued using the new identity. All references to the merged identity are replaced with the new identity and the merged identity is removed. The active session of the new identity is marked as “Drop-off” and closed.

Due to the above-mentioned behavior in the user identity following changes can be seen:

  • Analytics and Chat History will be updated associating all the sessions related to the merged identity with the new identity.
  • The sessions data is updated replacing the merged identity with the new identity.
  • The Billing Session tracking merged identity’s conversation will be marked as new identity.

Custom Meta Tags via webSDK

With the release of ver8.0 of the platform, you can directly add Custom Meta Tags from all supported internal channels (Web SDK/IVR / IVRVoice / Webhook channels). You can define Session, User, and Message level meta-tags. These tags will be added to the Conversation Session as soon as it is created.

botOptions.botInfo = {name:"<bot_name>", "_id":"<bot_id",
                           customData :{"name":"John"},
                           "metaTags": { 
                                 "messageLevelTags": [{ "name": "tag1", value: "message"}],
                                 "sessionLevelTags": [{ "name": "tag2", value: "session"}],
                                 "userLevelTags": [{ "name": "tag3", value: "user"}]
                                 }  
                          };

Common errors

Some commonly encountered errors are:

  • A wrong URL is given in index.html, users see a 404 error. Double check the URL. URL changes depending on whether you are hosting the assistant on your own web SDK or on Kore’s web SDK. If its Kore web SDK, then the URL is http://demo.kore.net:3000/users/sts 7. If you are hosting on your in-house web SDK, then provide the respective URL.
  • missing/Invalid jwt.sub(): This error occurs for enterprise assistants, when the user’s email id is not given in the index.html file. Provide users identity as shown below in index.html botOptions.userIdentity = ‘x@gmail.com’;// Provide users email id here.
  • Not found: User sees this error when either wrong clientID or no clientID is given. Check the correct ClientID from Bot – API Extensions option botOptions.clientId = “{clientID}”; // secure client-id.
  • error verifying the jwt: the Wrong clientSecret is given in index.html: Check the correct clientSecret you get from Bot – API Extensions option “clientSecret”: "{clientSecret}” //provide clientSecret here.

After you install and test the Web SDK using the test application and your local host server, you can use the same concept to install and configure the Web SDK in your own enterprise application. You will just need to reconfigure the file paths and URLs in the index.html file of the Web SDK to point to your website and servers, and configure a Kore.ai assistant for the Web/Mobile Client channel with JWT credentials for your enterprise.

메뉴