시작
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. Create a Travel Virtual Assistant

Create a Travel Virtual Assistant

After you have signed up with the Kore.ai XO Platform, the next step is to create a Virtual Assistant. Before you create it, we recommend you to go through the basics of building a VA by reading this article.

This present article takes you through the creation of a simple, travel related VA, that gives users the flight status arriving/departing from Los Angeles International Airport. 

Assistant Capabilities

This assistant can perform the following tasks:

  • Ask the user if they want to know about the arrivals or departures.
  • Make a service call to an API to fetch the details of flights arriving and departing out of the airport.
  • Display the flight numbers based on the user preference of Arrival or Departure.
  • Request the user to select a flight number.
  • Display the status details of the selected flight.
  • Handle any errors.

Create the Assistant

To build your Travel Virtual Assistant, follow the steps below: 

  1. On the landing page, click New Bot.
  2. In the Create New Bot window, select Start from Scratch.
  3. Enter a Name
  4. Select an icon or click the + icon to upload your own. Images should be in PNG format and should not exceed 40×40 pixels. The file size is limited to 80kb. 
  5. Select Travel Management as the Purpose of your VA.
  6. Choose Standard Bot as the Bot Type.
  7. Select the Default Language.
  8. Click Proceed when ready.

  9. Next, you can generate use cases for your new Virtual Assistant. Add a meaningful description and click Get Use Cases to generate intents that will be automatically added to the VA. You can update the Bot Name and Purpose and remove use cases. 
  10. Click Create to create your VA with generated use cases, or click Create without Use Cases to create your VA without any generated use cases.

  11. Wait a few moments for your VA to be configured. Once done, you can continue developing it. If you have chosen to generate use cases, you will find them as Dialog Tasks.

Create a Dialog Task

After creating your assistant, you are directed to the Bot Summary page. The first step is to add an Intent Dialog to support various business-specific use cases. The Intent Dialog is the first step in the user-VA conversation flow.

To create a Dialog Task, please follow the steps below:

  1. On the Tasks widget, click + New Task and select Dialog Task.

  2. On the Create Dialog page, enter the following details:
    • Intent Name – Enter the Intent name. This is the phrase that triggers the dialog. The intent name must be simple and not more than 3-4 words. For example, Check flight status.
    •  Under More Options, you can add a description and other dialog-related details. Let us retain the default settings.
  3. Click Proceed.

  4. When prompted to upgrade to Conversation Driven Dialog Builder, select Upgrade. For instructions on the Legacy Dialog Builder, refer here
  5. Once your task has been created, you will see the Dialog Builder Canvas, with the first node displayed – the Intent Node, which receives the name of the task and represents the main node within the Dialog Task. Learn more about working with the Dialog Builder.

Create a User Preference Entity Node

An Entity node is typically used to gather information from the user. Let us use it to capture the user preference for arrival or departure details.

  1. Click the + icon next to the User Intent node.
  2. Select Entity > + New Entity.

  3. You can also drag and drop Entity from the node panel on the left.
  4. Click the newly added Entity node to open the Entity window.
  5. By default, the Component Properties tab is selected.
    1. Under the General Settings section, enter the following details:
      • Name
      • Display Name
      • Type: Select List of Items (enumerated) from the drop-down list. You can provide a list of values that the user can select. To add a list of values:
        1. Click the Settings icon next to the field.

        2. Select the Static List option.
        3. Under the Keys & Values To Use section, enter the Display Name as Arrival and Departure in separate rows. Value and Synonyms columns auto-populate, leave them as is.
        4. Define the percentage of Auto Correction to be applied to match the user’s input to a value in the list. Set to 0 if you do not want to apply auto correction at all.
        5. Click Save.
  6. Go back to the Entity window.
  7. Under the User Prompts section, enter the following text:
Hello {{context.session.UserContext.firstName}}! Welcome to *Los Angeles International Airport*.
I can help you with flight Arrival/Departure information. Please select your preference.
Note: The context variable retrieves the user’s first name. Also, markdown is used for the airport name to appear in bold.
    1. Under the Display List of Values section, select Yes, use channel-specific standard formatting for default messages and show the available list of values to the end-user option. This displays the list of values as a button template in supported channels.

    2. Close the Entity window.

Create a Service Node

A Service Bot Action node allows you to make a backend API call. Here the service node is used to call an API to get flight information for flights From and To LAX airport. In this tutorial, a dummy API setup is used.

  1. Click the + icon below the Preference Entity node.
  2. Select Bot Action > + New Bot Action.
  3. Under the General Settings section, enter the following details:
    • Name: FlightDetails
    • Display Name: Flight Details
  4. Click the + icon next to the Bot Action node to expand the Bot Action.
  5. From within the Bot Action node, click +.
  6. Select Service > + New service. The service node is used to make a backend API call to get flight information for flights From and To LAX airport.
  7. Click the Service node to open the Service window, by default, the Component Properties tab is selected.
  8. Under the General Settings section, enter the following details:
    1. Name: Fetchflightdetails
    2. Display Name: Fetch Flight Details
    3. Service Type: Custom Service
    4. Type: Webservice
    5. Sub Type: REST
    6. Under the Request Definition section, click DEFINE REQUEST.
    7. On the Define Request page, enter the following details:
      1. Request TypeGET
      2. Request URLhttp://5e85a56644467600161c6579.mockapi.io/FlightDetails
        This API does not require any Auth or Header Parameters.
      3. Click the Test Request tab.
        1. Click Test on the top-right.
        2. Wait for the test to complete and you get a Status Code 200.
        3. Click Save as Sample Response.
        4. Click Save.

    8. Return to the dialog builder.
  9. Under the Connections section, set the Default Connection Rule to End of Bot Action.

  10. Close the Service window.
  11. Collapse the Bot Action node.

Create a Flight Selection Entity Node

This Entity node is to capture the Flight Number for which the user wants the status details.

  1. Click the + icon next to the Flight Details Bot Action node.
  2. Select Entity > + New entity . The Entity node is required to capture the flight number selected by the user.
  3. In the Entity window, by default, the Component Properties tab is selected.
  4. Under the General Settings section, enter the following details:
    • Name: SelectFlight
    • Display Name: Select Flight 
    • Type: String (users can write a custom script to convert the API string output to a list of values in the following steps, this is the requirement of the dummy API used)
  5. Under the User Prompts section, enter the following text:

    Please provide the flight number.
    1. Manage: Users can define a specific prompt for the Web SDK channel.
    2. Click Manage. Read more about managing user prompts.
    3. Click Add User Prompts.
    4. In the New Prompt Message window, select Web/Mobile client from the Channel drop-down list.
    5. Under the Message section, delete all text from the Plain Text tab and click the Advanced tab.
    6. Copy and paste the following JavaScript into the Advanced tab. The JavaScript extracts flight numbers matching user preference from the string output from API call and displays them in the Quick Reply format.
      var data = context.Fetchflightdetails.response.body.details;
      context.flights = [];
      context.info;
      var msg;
      for (var i = 0; i < data.length; i++)
      {
          if (context.entities.Preference == data[i].Type)
          {
              var details = {
                  "Airlines" : data[i].Airlines,
                  "FlightNo" : data[i].FlightNo,
                  "Airport" : data[i].Airport,
                  "AirportName" : data[i].AirportName,
                  "Time" : data[i].Time
              };
              context.flights.push(details);
          }
      }
      var message = {
          "type" : "template",
          "payload" : {
             "template_type" : "quick_replies",
             "text" : "Here are the flights " + context.entities.Preference + " details for Los Angeles International Airport today. Please select the flight number to see details",
             "quick_replies" : []
          }
      };
      for (i=0; i < context.flights.length; i++)
      {
         var replies = {
              "content_type":"text",
              "title" : context.flights[i].FlightNo,
              "payload" : context.flights[i].FlightNo
          };
      message.payload.quick_replies.push(replies);
      }
      print(JSON.stringify(message));
  6. Click Save.
  7. Go back to Dialog Builder and close the Entity window.

Create a Script Node

A Script node is used to write custom JavaScript in the Dialog task. Here, users can use the script to extract the selected flight details. Later, users can add more functionality to this script. To add and configure a script node, follow the steps below:

  1. Click the + icon below the Select Flight Entity node.
  2. Select Bot Action > + New Bot Action.
  3. Under the General Settings section, enter the following details:
    • Name: FlightValidation
    • Display Name: Flight Validation 
  1. Click the + next to the Bot Action node to expand the Bot Action.
  2. From within the Bot Action node click +
  3. Select Script > + New script.
  4. On the Script window, by default, the Component Properties tab is selected.
  5. Under the General Settings section, enter the following details:
    • Name: ValidateFlight
    • Display Name: Validate Flight 
  1. Under the Script Definition section, click Define Script.
  2. On the Add Script dialog box, copy and paste the following JavaScript. This code extracts the details of the selected flight number and also mitigates potential task failures caused by users not selecting a preference and instead manually entering information that is not found within the Context. Learn more about the Context Object.
    context.valid = false;
    context.details;
    var x = context.flights.length;
    for (var l = 0; l < x; l++)
    {
        if (context.entities.SelectFlight == context.flights[l].FlightNo)
        {
             context.valid = true;
             context.details = {
                "Airlines" : context.flights[l].Airlines,
                "FlightNo" : context.flights[l].FlightNo,
                "Airport" : context.flights[l].Airport,
                "AirportName" : context.flights[l].AirportName,
                "Time" :context.flights[l].Time
            };
            break;
        }
    }
    if (context.valid === false)
    {
        delete context.entities.SelectFlight;
    }
  3. Click Save.

  4. Under the Connections section, set the Default Connection Rule to End of Bot Action
  5. Close the Script window.
  6. Collapse the Bot Action node.

Create a Message Node to provide the Flight Status

A Message node is used to display a message from the VA to the user. Here, users can use the Message node to show appropriate flight details, based on user preference. This message node is triggered when the user enters a valid flight number.

  1. Click the + icon next to the Validate Flight Script node.
  2. Select Message > New message node +.
  3. On the Message window, by default, the Component Properties tab is selected.
  4. Under the General Settings section, enter the following details:
    • Name: FlightStatus
    • Display Name: Flight Status
  1. Under the Bot Responses section, enter the following text:
    Here are your flight details.
  2. Click Enter to save.
  3. Manage Prompts: Users can define a specific prompt for the Web SDK channel as follows:
    1. Click Manage
    2. On the Manage Bot Responses page, click Add User Prompts.
    3. Select Web/Mobile client from the Channel drop-down list.
    4. Under the Message section, delete all text in the Plain Text tab and click the Advanced tab.
    5. Copy and paste the following JavaScript. The JavaScript is written to display the flight details in the Table format.
      var elements = [context.details];
      var message = {
          "type": "template",
          "payload": {
              "template_type": "table",
              "text": "Here are your flight details",
              "columns": [
                  ["Airline"],["FlightNo"], ["Airport"], ["Time"]
              ],
              "table_design": "regular",
              speech_hint: "Here are your flight details",
              elements: []
          }
      };
      var ele = [];
      for (var i = 0; i < elements.length; i++) {
          var elementArr = [elements[i].Airlines, elements[i].FlightNo, elements[i].Airport, elements[i].Time];
          ele.push({'Values': elementArr});
      }
      message.payload.elements = ele;
      print(JSON.stringify(message));
    6. Click Save.
  1. Return to the Message window.
  2. On the Message window, click the Connections tab.
    • From the drop-down list, change the default connection from Not Connected to End of Dialog.
    • Click Save.
  3. Close the Message window.

When you have finished configuring your Dialog Task, it should look something like the illustration below.

Create a Conditional Flow for an Error Message

The Conditional Flow is required when, for example, the user provides input that cannot be identified by the VA, rather than selecting from one of the options you have configured (i.e.: either Arrivals or Departures.) In such a case, you would want to have the VA respond to the user with an error message.

The following are the steps required in order to add the conditional flow from the Validate Flight Script node. A new connection from this Script node to a new Message node is established. This is to display an error message from the VA to the user and redirect to select the flight number again.

Create the Error Message

  1. Hover over the connection between Flight Validation Bot Action node and Flight Status message node.
  2. You can see the Add Node button, click the button and then on the “+” to insert a node.
  3. Create a new Message node.
    1. Select Message > + New Message.
    2. On the Message window, by default, the Component Properties tab is selected.
    3. Under the General Settings section, enter the following details:
      1. Name: ErrorMessage
      2. Display Name: Error Message
    4. Under the Bot Responses section, enter the text:
      The Flight number you entered is incorrect. Let us start again.
    5. Click the Connections tab.
    6. From the drop-down list, change the default connection from FlightStatus to SelectFlight.
    7. Close the Error Message window.

Add IF Condition

As you can see in the demonstration above, the initial validation message remains disconnected after adding the error message. To fix this, you need to add a conditional connection so that the Flight Validation Bot Action Node connects to the Flight Status Message node to provide flight information; or to the Error Message, so the user is asked to provide valid input. The steps to take in order to achieve this are the following:

  1. Click the Flight Validation Bot Action node.
  2. On the Flight Validation Bot Action window, click the Connections tab, and follow the steps below:
    1. Click + ADD IF under Bot Action Group Connections.
    2. Under the IF section, Select Context.
    3. For If Condition, enter “valid” in the context text field.
    4. Select the operator as Equals To.
    5. Enter “true” in the value text field.
    6. If this condition is true, then the dialog goes to FlightStatus.
    7. Under the ELSE section,
    8. If this condition is false, then the dialog goes to ErrorMessage.
    9. Close the Validate Flight Script window.
    10. Click and drag the ErrorMessage node to the right to view the flow.

When completed, the task might look similar to the illustration below:

 

 

 

 

 

 

 

 

Add Events

Currently, the assistant is waiting for user input on the start. However, it can also guide the user at the start of the conversation. For this, you can add an Event Handler to initiate this task every time a new connection is established from the Web/Mobile SDK. Learn more about Event Handlers.

  1. Close the Dialog Builder to go back to the Dialog Tasks page.
  2. From the Left Navigation pane, and select Intelligence > Events.
  3. From the events list, click Configure against the On Connect event.
  4. On the On Connect window, by default, the Initiate Task option is selected; retain it.
  5. From the drop-down list, select the Get Flight Status task.
  6. Click Save.

Test the Assistant

To test the Dialog task, you can use the Talk to bot option at the bottom right. Since the onConnect event is configured, the dialog is automatically initiated. Alternately, you can always try the following utterance (intent name) Get me the flight status.

Follow the instructions:

  1. Select Arrival / Departure.
  2. Enter an invalid flight number rather than selecting on of the prompts.
  3. You can see the appropriate error message and be prompted to enter the flight number again.
  4. Select a flight number from the prompts.
  5. You can see the flight details in a tabular format.

You have successfully created and tested your first Virtual Assistant.

Create a Travel Virtual Assistant

After you have signed up with the Kore.ai XO Platform, the next step is to create a Virtual Assistant. Before you create it, we recommend you to go through the basics of building a VA by reading this article.

This present article takes you through the creation of a simple, travel related VA, that gives users the flight status arriving/departing from Los Angeles International Airport. 

Assistant Capabilities

This assistant can perform the following tasks:

  • Ask the user if they want to know about the arrivals or departures.
  • Make a service call to an API to fetch the details of flights arriving and departing out of the airport.
  • Display the flight numbers based on the user preference of Arrival or Departure.
  • Request the user to select a flight number.
  • Display the status details of the selected flight.
  • Handle any errors.

Create the Assistant

To build your Travel Virtual Assistant, follow the steps below: 

  1. On the landing page, click New Bot.
  2. In the Create New Bot window, select Start from Scratch.
  3. Enter a Name
  4. Select an icon or click the + icon to upload your own. Images should be in PNG format and should not exceed 40×40 pixels. The file size is limited to 80kb. 
  5. Select Travel Management as the Purpose of your VA.
  6. Choose Standard Bot as the Bot Type.
  7. Select the Default Language.
  8. Click Proceed when ready.

  9. Next, you can generate use cases for your new Virtual Assistant. Add a meaningful description and click Get Use Cases to generate intents that will be automatically added to the VA. You can update the Bot Name and Purpose and remove use cases. 
  10. Click Create to create your VA with generated use cases, or click Create without Use Cases to create your VA without any generated use cases.

  11. Wait a few moments for your VA to be configured. Once done, you can continue developing it. If you have chosen to generate use cases, you will find them as Dialog Tasks.

Create a Dialog Task

After creating your assistant, you are directed to the Bot Summary page. The first step is to add an Intent Dialog to support various business-specific use cases. The Intent Dialog is the first step in the user-VA conversation flow.

To create a Dialog Task, please follow the steps below:

  1. On the Tasks widget, click + New Task and select Dialog Task.

  2. On the Create Dialog page, enter the following details:
    • Intent Name – Enter the Intent name. This is the phrase that triggers the dialog. The intent name must be simple and not more than 3-4 words. For example, Check flight status.
    •  Under More Options, you can add a description and other dialog-related details. Let us retain the default settings.
  3. Click Proceed.

  4. When prompted to upgrade to Conversation Driven Dialog Builder, select Upgrade. For instructions on the Legacy Dialog Builder, refer here
  5. Once your task has been created, you will see the Dialog Builder Canvas, with the first node displayed – the Intent Node, which receives the name of the task and represents the main node within the Dialog Task. Learn more about working with the Dialog Builder.

Create a User Preference Entity Node

An Entity node is typically used to gather information from the user. Let us use it to capture the user preference for arrival or departure details.

  1. Click the + icon next to the User Intent node.
  2. Select Entity > + New Entity.

  3. You can also drag and drop Entity from the node panel on the left.
  4. Click the newly added Entity node to open the Entity window.
  5. By default, the Component Properties tab is selected.
    1. Under the General Settings section, enter the following details:
      • Name
      • Display Name
      • Type: Select List of Items (enumerated) from the drop-down list. You can provide a list of values that the user can select. To add a list of values:
        1. Click the Settings icon next to the field.

        2. Select the Static List option.
        3. Under the Keys & Values To Use section, enter the Display Name as Arrival and Departure in separate rows. Value and Synonyms columns auto-populate, leave them as is.
        4. Define the percentage of Auto Correction to be applied to match the user’s input to a value in the list. Set to 0 if you do not want to apply auto correction at all.
        5. Click Save.
  6. Go back to the Entity window.
  7. Under the User Prompts section, enter the following text:
Hello {{context.session.UserContext.firstName}}! Welcome to *Los Angeles International Airport*.
I can help you with flight Arrival/Departure information. Please select your preference.
Note: The context variable retrieves the user’s first name. Also, markdown is used for the airport name to appear in bold.
    1. Under the Display List of Values section, select Yes, use channel-specific standard formatting for default messages and show the available list of values to the end-user option. This displays the list of values as a button template in supported channels.

    2. Close the Entity window.

Create a Service Node

A Service Bot Action node allows you to make a backend API call. Here the service node is used to call an API to get flight information for flights From and To LAX airport. In this tutorial, a dummy API setup is used.

  1. Click the + icon below the Preference Entity node.
  2. Select Bot Action > + New Bot Action.
  3. Under the General Settings section, enter the following details:
    • Name: FlightDetails
    • Display Name: Flight Details
  4. Click the + icon next to the Bot Action node to expand the Bot Action.
  5. From within the Bot Action node, click +.
  6. Select Service > + New service. The service node is used to make a backend API call to get flight information for flights From and To LAX airport.
  7. Click the Service node to open the Service window, by default, the Component Properties tab is selected.
  8. Under the General Settings section, enter the following details:
    1. Name: Fetchflightdetails
    2. Display Name: Fetch Flight Details
    3. Service Type: Custom Service
    4. Type: Webservice
    5. Sub Type: REST
    6. Under the Request Definition section, click DEFINE REQUEST.
    7. On the Define Request page, enter the following details:
      1. Request TypeGET
      2. Request URLhttp://5e85a56644467600161c6579.mockapi.io/FlightDetails
        This API does not require any Auth or Header Parameters.
      3. Click the Test Request tab.
        1. Click Test on the top-right.
        2. Wait for the test to complete and you get a Status Code 200.
        3. Click Save as Sample Response.
        4. Click Save.

    8. Return to the dialog builder.
  9. Under the Connections section, set the Default Connection Rule to End of Bot Action.

  10. Close the Service window.
  11. Collapse the Bot Action node.

Create a Flight Selection Entity Node

This Entity node is to capture the Flight Number for which the user wants the status details.

  1. Click the + icon next to the Flight Details Bot Action node.
  2. Select Entity > + New entity . The Entity node is required to capture the flight number selected by the user.
  3. In the Entity window, by default, the Component Properties tab is selected.
  4. Under the General Settings section, enter the following details:
    • Name: SelectFlight
    • Display Name: Select Flight 
    • Type: String (users can write a custom script to convert the API string output to a list of values in the following steps, this is the requirement of the dummy API used)
  5. Under the User Prompts section, enter the following text:

    Please provide the flight number.
    1. Manage: Users can define a specific prompt for the Web SDK channel.
    2. Click Manage. Read more about managing user prompts.
    3. Click Add User Prompts.
    4. In the New Prompt Message window, select Web/Mobile client from the Channel drop-down list.
    5. Under the Message section, delete all text from the Plain Text tab and click the Advanced tab.
    6. Copy and paste the following JavaScript into the Advanced tab. The JavaScript extracts flight numbers matching user preference from the string output from API call and displays them in the Quick Reply format.
      var data = context.Fetchflightdetails.response.body.details;
      context.flights = [];
      context.info;
      var msg;
      for (var i = 0; i < data.length; i++)
      {
          if (context.entities.Preference == data[i].Type)
          {
              var details = {
                  "Airlines" : data[i].Airlines,
                  "FlightNo" : data[i].FlightNo,
                  "Airport" : data[i].Airport,
                  "AirportName" : data[i].AirportName,
                  "Time" : data[i].Time
              };
              context.flights.push(details);
          }
      }
      var message = {
          "type" : "template",
          "payload" : {
             "template_type" : "quick_replies",
             "text" : "Here are the flights " + context.entities.Preference + " details for Los Angeles International Airport today. Please select the flight number to see details",
             "quick_replies" : []
          }
      };
      for (i=0; i < context.flights.length; i++)
      {
         var replies = {
              "content_type":"text",
              "title" : context.flights[i].FlightNo,
              "payload" : context.flights[i].FlightNo
          };
      message.payload.quick_replies.push(replies);
      }
      print(JSON.stringify(message));
  6. Click Save.
  7. Go back to Dialog Builder and close the Entity window.

Create a Script Node

A Script node is used to write custom JavaScript in the Dialog task. Here, users can use the script to extract the selected flight details. Later, users can add more functionality to this script. To add and configure a script node, follow the steps below:

  1. Click the + icon below the Select Flight Entity node.
  2. Select Bot Action > + New Bot Action.
  3. Under the General Settings section, enter the following details:
    • Name: FlightValidation
    • Display Name: Flight Validation 
  1. Click the + next to the Bot Action node to expand the Bot Action.
  2. From within the Bot Action node click +
  3. Select Script > + New script.
  4. On the Script window, by default, the Component Properties tab is selected.
  5. Under the General Settings section, enter the following details:
    • Name: ValidateFlight
    • Display Name: Validate Flight 
  1. Under the Script Definition section, click Define Script.
  2. On the Add Script dialog box, copy and paste the following JavaScript. This code extracts the details of the selected flight number and also mitigates potential task failures caused by users not selecting a preference and instead manually entering information that is not found within the Context. Learn more about the Context Object.
    context.valid = false;
    context.details;
    var x = context.flights.length;
    for (var l = 0; l < x; l++)
    {
        if (context.entities.SelectFlight == context.flights[l].FlightNo)
        {
             context.valid = true;
             context.details = {
                "Airlines" : context.flights[l].Airlines,
                "FlightNo" : context.flights[l].FlightNo,
                "Airport" : context.flights[l].Airport,
                "AirportName" : context.flights[l].AirportName,
                "Time" :context.flights[l].Time
            };
            break;
        }
    }
    if (context.valid === false)
    {
        delete context.entities.SelectFlight;
    }
  3. Click Save.

  4. Under the Connections section, set the Default Connection Rule to End of Bot Action
  5. Close the Script window.
  6. Collapse the Bot Action node.

Create a Message Node to provide the Flight Status

A Message node is used to display a message from the VA to the user. Here, users can use the Message node to show appropriate flight details, based on user preference. This message node is triggered when the user enters a valid flight number.

  1. Click the + icon next to the Validate Flight Script node.
  2. Select Message > New message node +.
  3. On the Message window, by default, the Component Properties tab is selected.
  4. Under the General Settings section, enter the following details:
    • Name: FlightStatus
    • Display Name: Flight Status
  1. Under the Bot Responses section, enter the following text:
    Here are your flight details.
  2. Click Enter to save.
  3. Manage Prompts: Users can define a specific prompt for the Web SDK channel as follows:
    1. Click Manage
    2. On the Manage Bot Responses page, click Add User Prompts.
    3. Select Web/Mobile client from the Channel drop-down list.
    4. Under the Message section, delete all text in the Plain Text tab and click the Advanced tab.
    5. Copy and paste the following JavaScript. The JavaScript is written to display the flight details in the Table format.
      var elements = [context.details];
      var message = {
          "type": "template",
          "payload": {
              "template_type": "table",
              "text": "Here are your flight details",
              "columns": [
                  ["Airline"],["FlightNo"], ["Airport"], ["Time"]
              ],
              "table_design": "regular",
              speech_hint: "Here are your flight details",
              elements: []
          }
      };
      var ele = [];
      for (var i = 0; i < elements.length; i++) {
          var elementArr = [elements[i].Airlines, elements[i].FlightNo, elements[i].Airport, elements[i].Time];
          ele.push({'Values': elementArr});
      }
      message.payload.elements = ele;
      print(JSON.stringify(message));
    6. Click Save.
  1. Return to the Message window.
  2. On the Message window, click the Connections tab.
    • From the drop-down list, change the default connection from Not Connected to End of Dialog.
    • Click Save.
  3. Close the Message window.

When you have finished configuring your Dialog Task, it should look something like the illustration below.

Create a Conditional Flow for an Error Message

The Conditional Flow is required when, for example, the user provides input that cannot be identified by the VA, rather than selecting from one of the options you have configured (i.e.: either Arrivals or Departures.) In such a case, you would want to have the VA respond to the user with an error message.

The following are the steps required in order to add the conditional flow from the Validate Flight Script node. A new connection from this Script node to a new Message node is established. This is to display an error message from the VA to the user and redirect to select the flight number again.

Create the Error Message

  1. Hover over the connection between Flight Validation Bot Action node and Flight Status message node.
  2. You can see the Add Node button, click the button and then on the “+” to insert a node.
  3. Create a new Message node.
    1. Select Message > + New Message.
    2. On the Message window, by default, the Component Properties tab is selected.
    3. Under the General Settings section, enter the following details:
      1. Name: ErrorMessage
      2. Display Name: Error Message
    4. Under the Bot Responses section, enter the text:
      The Flight number you entered is incorrect. Let us start again.
    5. Click the Connections tab.
    6. From the drop-down list, change the default connection from FlightStatus to SelectFlight.
    7. Close the Error Message window.

Add IF Condition

As you can see in the demonstration above, the initial validation message remains disconnected after adding the error message. To fix this, you need to add a conditional connection so that the Flight Validation Bot Action Node connects to the Flight Status Message node to provide flight information; or to the Error Message, so the user is asked to provide valid input. The steps to take in order to achieve this are the following:

  1. Click the Flight Validation Bot Action node.
  2. On the Flight Validation Bot Action window, click the Connections tab, and follow the steps below:
    1. Click + ADD IF under Bot Action Group Connections.
    2. Under the IF section, Select Context.
    3. For If Condition, enter “valid” in the context text field.
    4. Select the operator as Equals To.
    5. Enter “true” in the value text field.
    6. If this condition is true, then the dialog goes to FlightStatus.
    7. Under the ELSE section,
    8. If this condition is false, then the dialog goes to ErrorMessage.
    9. Close the Validate Flight Script window.
    10. Click and drag the ErrorMessage node to the right to view the flow.

When completed, the task might look similar to the illustration below:

 

 

 

 

 

 

 

 

Add Events

Currently, the assistant is waiting for user input on the start. However, it can also guide the user at the start of the conversation. For this, you can add an Event Handler to initiate this task every time a new connection is established from the Web/Mobile SDK. Learn more about Event Handlers.

  1. Close the Dialog Builder to go back to the Dialog Tasks page.
  2. From the Left Navigation pane, and select Intelligence > Events.
  3. From the events list, click Configure against the On Connect event.
  4. On the On Connect window, by default, the Initiate Task option is selected; retain it.
  5. From the drop-down list, select the Get Flight Status task.
  6. Click Save.

Test the Assistant

To test the Dialog task, you can use the Talk to bot option at the bottom right. Since the onConnect event is configured, the dialog is automatically initiated. Alternately, you can always try the following utterance (intent name) Get me the flight status.

Follow the instructions:

  1. Select Arrival / Departure.
  2. Enter an invalid flight number rather than selecting on of the prompts.
  3. You can see the appropriate error message and be prompted to enter the flight number again.
  4. Select a flight number from the prompts.
  5. You can see the flight details in a tabular format.

You have successfully created and tested your first Virtual Assistant.

메뉴