{"id":48057,"date":"2022-10-04T18:12:10","date_gmt":"2022-10-04T17:12:10","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=48057"},"modified":"2023-01-30T08:18:42","modified_gmt":"2023-01-30T08:18:42","slug":"travel-va-web-sdk-tutorial","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/how-tos\/travel-planing-assistant\/travel-va-web-sdk-tutorial\/","title":{"rendered":"Travel VA: Web SDK Tutorial"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p>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.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h1><span class=\"ez-toc-section\" id=\"Web_SDK_Tutorial_Overview\"><span style=\"font-weight: 400\">Web SDK Tutorial Overview<\/span><\/span><\/h1>\n<p>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.<\/p>\n<ol>\n<li><strong>Build the assistant to be integrated &#8211; <\/strong>For this tutorial, you will install the <em>Travel Planning Sample<\/em> assistant that uses open APIs to get flight and location information, along with weather reports.<\/li>\n<li><strong>Configure Web\/Mobile Client channel<\/strong> &#8211; To use the <em>Travel Planning Sample Virtual Assistant<\/em> with the Web SDK, you must configure the assistant for the Web\/Mobile Client channel.<\/li>\n<li><strong>Create a new Client App<\/strong> &#8211; When you configure the Web\/Mobile Client channel for the <em>Travel Planning Sample Virtual Assistant<\/em>, you must create a client app and select the JWT signing algorithm used to generate the authentication tokens.<\/li>\n<li><strong>Publish the assistant<\/strong>&#8211; After you have configured the <em>Travel Planning Sample Virtual Assistant<\/em>, you must publish the assistant which sends the bot to the Bots Admin for approval.<\/li>\n<li><strong>Approve and Deploy the assistant<\/strong>&#8211; In the Bots Admin Console, the published assistant and tasks must be approved to deploy.<\/li>\n<li><strong>Download and install Node.js<\/strong> &#8211; You will need to install <span style=\"color: #0000ff\">Node.js<\/span> 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.<\/li>\n<li><strong>Download and uncompress the test application<\/strong> &#8211; \u00a0The test application,\u00a0<a href=\"https:\/\/s3.amazonaws.com\/static-kore\/downloads\/SDKApp.zip\">SDKApp<\/a> 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.<\/li>\n<li><strong>Download and uncompress the Kore.ai Web SDK<\/strong> &#8211; 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 <span style=\"color: #0000ff\">index.html<\/span> file for your computer.<\/li>\n<li><strong>Start your application and view the assistant in a web browser<\/strong> &#8211; In a <strong>Terminal<\/strong> window, you will start the JWT service, and then view the assistant in a web browser.<\/li>\n<\/ol>\n<p>Now let us see detailed step by step implementation.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h1><span class=\"ez-toc-section\" id=\"Installing_and_Running_the_Koreai_Web_SDK\"><span style=\"font-weight: 400\">Installing and Running the Kore.ai Web SDK<\/span><\/span><\/h1>\n<p>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. <em>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.<\/em><\/p>\n<ol>\n<li>Log in to XO Platform, and click the\u00a0<strong>down-arrow<\/strong>\u00a0next to the\u00a0\u00a0<strong>+New Bot<\/strong>\u00a0and select\u00a0<strong>Install Sample Virtual Assistants.<\/strong><\/li>\n<li>Hover over\u00a0<strong>Travel Planning Sample<\/strong>, and then click <strong>Install<\/strong>.<\/li>\n<li>The <em>Travel Planning Sample installed successfully<\/em> message is displayed and the Sample Virtual Assistant is added to your <strong>Bots<\/strong> left-hand navigation menu.<\/li>\n<\/ol>\n<p><em>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. <a href=\"\/docs\/bots\/bot-builder-tool\/channel-enablement\/adding-the-webmobile-client-channel\/\" target=\"new window\" rel=\"noopener noreferrer\">See here<\/a> for a detailed explanation of the steps.<\/em><\/p>\n<ol start=\"4\">\n<li>On the XO Platform top menu, select the <strong>Build<\/strong> tab.<\/li>\n<li>From the left menu, click <strong>Integrations &gt; BotKit<\/strong>.<\/li>\n<li>In the <strong>Select App<\/strong> drop-down list, click <strong>Create App<\/strong>.\u00a0The <strong>Create Client App<\/strong> dialog is displayed.<\/li>\n<li>In the <strong>Name<\/strong> field,\u00a0enter a name for your app, for example, <span style=\"color: #0000ff\">My SDK Client App<\/span>.<\/li>\n<li>In the <strong>JWT Signing Algorithms<\/strong> section, select <strong>HS256<\/strong>\u00a0to generate the authentication tokens.<\/li>\n<li>Click <strong>Next -&gt; Done<\/strong>.<\/li>\n<li>The <strong>Web\/Mobile Client Channel<\/strong> page is displayed with the following JWT credentials, make a note of all these details:\n<ul>\n<li>Bot Name<\/li>\n<li>Bot ID<\/li>\n<li>Client ID<\/li>\n<li>Client Secret<br \/>We will be using them later in the Web SDK setup.<\/li>\n<\/ul>\n<\/li>\n<li>Click <strong>Save<\/strong>.<\/li>\n<\/ol>\n<p><em>Now that the assistant is created and defined for the Web\/Mobile Client channel, you are ready to publish and deploy it.<\/em><\/p>\n<div class=\"alert alert-info\"><strong>Note:<\/strong> By default, the <em>Travel Sample Planning<\/em> assistant is configured with <strong>Target Audience<\/strong> set to <strong>Enterprise Users<\/strong>\u00a0on the <strong>Build<\/strong> tab in the <strong>Configurations -&gt; General Settings.\u00a0<\/strong>Optionally, you can define this assistant for <strong>General Public<\/strong> use. Once this assistant is published, the <strong>Target Audience<\/strong> cannot be changed.<\/div>\n<ol start=\"12\">\n<li>On the <strong>Deploy<\/strong> tab, click <strong>Publish<\/strong>.<\/li>\n<li>On <strong>Publish <\/strong>page, select all tasks, and then click <strong>Proceed<\/strong>.<\/li>\n<li>Enter a comment and <strong>Confirm<\/strong> publish.<\/li>\n<\/ol>\n<p><em>After an enterprise developer publishes a assistant, it must be approved and assigned to the users for use.<\/em><\/p>\n<ol start=\"16\">\n<li>Complete one of the following assistant deployments in the Bots Admin Console depending if your bot <strong>Target Audience<\/strong> is set to <strong>Enterprise Users\u00a0<\/strong>or <strong>General Public<\/strong>. Complete one of the following:\n<ol>\n<li>In the Bots Admin Console, in the <strong>Bots Management<\/strong> module, on the <strong>Enterprise\u00a0Bots<\/strong> page,\u00a0click the <strong>Ellipses<\/strong>\u00a0\u00a0icon for the <em>Travel Planning Sample Virtual Assistant<\/em> that you want to deploy,\u00a0and then click <strong>Manage bot tasks<\/strong>. The <strong>Manage Bot Tasks<\/strong> dialog is displayed.<\/li>\n<li>In the <strong>Bot tasks<\/strong> field, click the <strong>Expand<\/strong>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"icon alignnone wp-image-6276 size-full\" src=\"\/wp-content\/uploads\/sites\/35\/ExpandIcon.png\" alt=\"BotsAdminExpandRight\" width=\"20\" height=\"32\" \/> icon to display the available and deployed tasks, select all tasks for this bot,\u00a0and then click <strong>Confirm<\/strong>.<\/li>\n<li>In the <strong>Manage bots tasks<\/strong> dialog, click <strong>Confirm<\/strong>. The <em>Bot status changed successfully<\/em> message is displayed.<\/li>\n<li>On the <strong>Enterprise\u00a0Bots<\/strong> page,\u00a0click the <strong>Ellipses<\/strong> icon for the<em>Travel Planning Sample Virtual Assistant<\/em>\u00a0that you want to assign the users to,\u00a0and then click <strong>Bot &amp; task assignments<\/strong>.<\/li>\n<li>The <strong>Bot &amp; task assignments<\/strong> dialog is displayed. Assign the assistant to your users, for all tasks, including yourself.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><em>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.<\/em><\/p>\n<ol start=\"17\">\n<li>To download and install <span style=\"color: #0000ff\"><em>node.js<\/em><\/span> on your computer, go to\u00a0<a href=\"https:\/\/nodejs.org\/en\/download\/\">https:\/\/nodejs.org\/en\/download\/<\/a>, and then select your OS as <span style=\"color: #0000ff\">.pkg<\/span> for Mac, and <span style=\"color: #0000ff\">.msi <\/span>for Windows.<\/li>\n<li>In a <strong>Terminal<\/strong> window,\u00a0run the <code>node -v<\/code> command to verify installation\u00a0and version, for example, <code>v6.10.2<\/code>.<\/li>\n<li>Locate the <strong>SDKApp\/sdk<\/strong> folder of your <span style=\"text-decoration: underline\">web server hosting the app<\/span> where you want to integrate the Kore assistant. For this tutorial, to download the test application and JWT web service, click\u00a0<a href=\"https:\/\/s3.amazonaws.com\/static-kore\/downloads\/SDKApp.zip\">SDKApp<\/a>, and unzip it.<\/li>\n<li>To download the Kore.ai Web SDK, go to\u00a0<a href=\"https:\/\/github.com\/Koredotcom\/web-kore-sdk\">https:\/\/github.com\/Koredotcom\/web-kore-sdk<\/a>, and then click <strong>Download<\/strong>. Extract all files to the <span style=\"color: #0000ff\"><em>&#8230;\/SDKApp\/sdk<\/em><\/span> folder mentioned in step above. Check for the release compatibility from the <a href=\"\/docs\/bots\/whats-new\/whats-new-in-this-release-bot-builder\/#SDK_Versions\" target=\"new window\" rel=\"noopener noreferrer\">release notes<\/a>.<\/li>\n<li>From the XO Platform\u00a0<strong>Web\/Mobile Client Channel<\/strong> page on the <strong>Deploy -&gt; Channels<\/strong> menu, copy the following (as mentioned in step 8 above):\n<ul>\n<li>clientSecret<\/li>\n<li>clientId<\/li>\n<li>Bot Name<\/li>\n<\/ul>\n<\/li>\n<li>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.\n<ul class=\"letters\">\n<li>Follow this step for the latest Web SDK file downloaded <span style=\"text-decoration: underline\">after ver7.2<\/span> of the platform i.e. <span style=\"text-decoration: underline\">after Feb 2020.<\/span>\n<ol type=\"A\">\n<li>Open the <span style=\"color: #0000ff\">index.html<\/span> file from the\u00a0<em><span style=\"color: #0000ff\">&#8230;\/SDKApp\/sdk\/UI<\/span><\/em> folder using a text editor.\u00a0Update the following lines to add the path to the <em><span style=\"color: #0000ff\">UI<\/span><\/em> folder:\n<p><code>&lt;script src=\"libs\/jquery.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"libs\/jquery.tmpl.min.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"libs\/jquery-ui.min.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;link href=\"libs\/jquery-ui.min.css\" rel=\"stylesheet\"&gt;&lt;\/link&gt;<br \/>\n&lt;script src=\"chatWindow.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;link href=\"chatWindow.css\" rel=\"stylesheet\"&gt;&lt;\/link&gt;<br \/><\/code><\/li>\n<li>Open the <span style=\"color: #0000ff\">kore-config.js<\/span> and update the <em>botOptions<\/em> parameters botInfo, clientId and clientSecret, and your email id as userIdentity.\n<pre>\u201cclientSecret\u201d: \u201c{client secret}\u201d\r\n$.ajax({\r\n   url: \u201chttp:\/\/localhost:3000\/api\/users\/getJWT\u201d,\r\n     \/\/this is sample url of a localhost. \r\n     \/\/This should include the url where you are hosting the bot.\r\n   botOptions.userIdentity = \u2018 \u2018;\r\n     \/\/ Provide users email id here\r\n   botOptions.clientId= \"{client id} \";\r\n     \/\/ secure client-id\r\n   _botOptions.botInfo= {name:\"{bot name}\",\"id\":\"{bot id\"};\r\n     \/\/ Kore bot name is case sensitive\r\n })<\/pre>\n<p>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.<\/li>\n<li>Ensure that in <span style=\"color: #0000ff\">kore-config.js <\/span>you set the audience for your assistant. Choose one of the following:\n<ul type=\"A\">\n<li><code>\"isAnonymous\": &lt;\u00a0<strong><em>false<\/em>\u00a0<\/strong>&gt;;<\/code> if the assistant is deployed for the <strong>enterprise users<\/strong>, and then set <code>botOptions.userIdentity = '<strong>&lt;<\/strong>\u00a0<strong><em>Your email ID<\/em> &gt;<\/strong>';<\/code> <strong>\u00a0 \u00a0 \u00a0 \u00a0&#8211; or &#8211;<\/strong><\/li>\n<li><code>\"isAnonymous\": &lt;\u00a0<strong><em>true<\/em>\u00a0<\/strong>&gt;;<\/code> if bot is deployed for <strong>Consumer Use<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<li>This step is valid for older Web SDK file downloaded <span style=\"text-decoration: underline\">before ver7.2<\/span> of the platform i.e. <span style=\"text-decoration: underline\">before Feb 2020<\/span>.\n<ul>\n<li>Open the <span style=\"color: #0000ff\">index.html<\/span> file from the\u00a0<em><span style=\"color: #0000ff\">&#8230;\/SDKApp\/sdk\/UI<\/span><\/em> folder using\u00a0a text editor:\n<ol>\n<li>Update the following lines to add the path to the <em><span style=\"color: #0000ff\">UI<\/span><\/em> folder:\n<p><code>&lt;script src=\"libs\/jquery.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"libs\/jquery.tmpl.min.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"libs\/jquery-ui.min.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;link href=\"libs\/jquery-ui.min.css\" rel=\"stylesheet\"&gt;&lt;\/link&gt;<br \/>\n&lt;script src=\"chatWindow.js\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;link href=\"chatWindow.css\" rel=\"stylesheet\"&gt;&lt;\/link&gt;<br \/><\/code><\/li>\n<li>Update the following parameters to run as local host:\n<pre>\u201cclientSecret\u201d: \u201c{client secret}\u201d\r\n$.ajax({\r\n  url: \u201chttp:\/\/localhost:3000\/api\/users\/getJWT\u201d,\r\n     \/\/this is sample url of a local host. \r\n     \/\/This should include the url where you are hosting the bot.\r\n  botOptions.userIdentity = \u2018 \u2018;\r\n     \/\/ Provide users email id here\r\n  botOptions.clientId= \"{client id} \";\r\n     \/\/ secure client-id\r\n  _botOptions.botInfo= {name:\"{bot name}\",\"id\":\"{bot id\"};\r\n     \/\/ Kore bot name is case sensitive\r\n })<\/pre>\n<table style=\"width: 100%;border-collapse: collapse;background-color: #fffbea\">\n<tbody>\n<tr>\n<td style=\"width: 100%\">\n<p><strong>Note<\/strong>: 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.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>Choose one of the following:\n<ul>\n<li><code>\"isAnonymous\": &lt;\u00a0<strong><em>false<\/em>\u00a0<\/strong>&gt;;<\/code> if the assistant is deployed for the <strong>enterprise users<\/strong>, and then set <code>botOptions.userIdentity = '<strong>&lt;<\/strong>\u00a0<strong><em>Your email ID<\/em> &gt;<\/strong>';<\/code> <strong>\u00a0 \u00a0 \u00a0 \u00a0&#8211; or &#8211;<\/strong><\/li>\n<li><code>\"isAnonymous\": &lt;\u00a0<strong><em>true<\/em>\u00a0<\/strong>&gt;;<\/code> if the assistant is deployed for <strong>Consumer Use<\/strong>.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Save your changes. <em>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.<\/em><\/li>\n<li>Go to home directory<code>cd SDKApp<\/code>.<\/li>\n<li>Install dependencies using the following command <code>npm install<\/code>. <a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/35\/start-server.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-15228\" src=\"\/wp-content\/uploads\/sites\/35\/start-server.png\" alt=\"\" width=\"668\" height=\"179\" \/><\/a><\/li>\n<li>Start SDKApp <code>node startServer.js<\/code>.<\/li>\n<li>Access the application in any browser using <em>localhost:3000<\/em>.<\/li>\n<\/ol>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Passing_data_via_webSDK\"><span style=\"font-weight: 400\">Passing data via webSDK<\/span><\/span><\/h2>\n<p>You can pass additional information of the user accessing the channel by adding the custom data at <strong>botInfo<\/strong> inside the <em>index.html<\/em> file.<\/p>\n<pre>botOptions.botInfo = {name: \"Banking Bot\", \r\n                              \"_id\": \"&lt;bot_id&gt;\", \r\n                              customData: \"value\"\r\n              };<\/pre>\n<p>Details like phone number, address, or location, etc., are examples of data that can be passed inside the <em><span style=\"text-decoration: underline\">customData<\/span><\/em>. <em><code>customData<\/code><\/em> can be accessed from <code>lastMessage<\/code> under the <code>BotUserSession<\/code> 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 <code>customData<\/code> in the <code>index.html<\/code> file as key-value pairs:<\/p>\n<pre>botOptions.botInfo = {name:\"&lt;bot_name&gt;\",\r\n                      \"_id\":\"&lt;bot_id\",\r\n                      customData:{\"name\":\"John\",\r\n                                  \"age\":30,\r\n                                   \"cars\": {\"car1\":\"Ford\",\r\n                                            \"car2\":\"BMW\",\r\n                                            \"car3\":\"Fiat\"\r\n                                             }\r\n                                   }\r\n                           };<\/pre>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20200723122801\/customData.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24099\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20200723122801\/customData.png\" alt=\"\" width=\"444\" height=\"492\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20200723122801\/customData.png 444w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20200723122801\/customData-271x300.png 271w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/a><\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Passing_Mapped_Identities\"><span style=\"font-weight: 400\">Passing Mapped Identities<\/span><\/span><\/h2>\n<p>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\u2019s known identity can be passed to the bot from the SDK as part of the \u2018<a href=\"\/docs\/bots\/sdks\/user-authorization-and-assertion\/#About_JWT\" target=\"_blank\" rel=\"noopener noreferrer\">JWT Grant API<\/a>\u2019 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.<\/p>\n<pre>{\r\n \"iat\": 1611810186883,\r\n \"exp\": 1611813786.883,\r\n \"aud\": \"https:\/\/idproxy.kore.com\/authorize\",\r\n \"iss\": \"cs-d3042d3e-7da4-55da-a94d-783349270cc0\",\r\n \"sub\": \"knowuser1@test.com\",\r\n \"isAnonymous\": \"false\",\r\n \"identityToMerge\": \"anonymoususer1@test.com\"\r\n}<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p> The following scenarios describe the bot behavior when dealing with the new identity and merged identity:<\/p>\n<ul>\n<li>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.<\/li>\n<li>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.<\/li>\n<li>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.<\/li>\n<li>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.<\/li>\n<li>When both the merged identity and the new identity are present in the system and both have an active session, then the merged identity&#8217;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 &#8220;Drop-off&#8221; and closed.<\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<p> Due to the above-mentioned behavior in the user identity following changes can be seen:<\/p>\n<ul>\n<li>Analytics and Chat History will be updated associating all the sessions related to the merged identity with the new identity.<\/li>\n<li>The sessions data is updated replacing the merged identity with the new identity.<\/li>\n<li>The Billing Session tracking merged identity&#8217;s conversation will be marked as new identity.<\/li>\n<\/ul>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h2><span class=\"ez-toc-section\" id=\"Custom_Meta_Tags_via_webSDK\"><span style=\"font-weight: 400\">Custom Meta Tags via webSDK<\/span><\/span><\/h2>\n<p>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.<\/p>\n<pre>botOptions.botInfo = {name:\"&lt;bot_name&gt;\", \"_id\":\"&lt;bot_id\",\r\n                           customData :{\"name\":\"John\"},\r\n                           \"metaTags\": { \r\n                                 \"messageLevelTags\": [{ \"name\": \"tag1\", value: \"message\"}],\r\n                                 \"sessionLevelTags\": [{ \"name\": \"tag2\", value: \"session\"}],\r\n                                 \"userLevelTags\": [{ \"name\": \"tag3\", value: \"user\"}]\r\n                                 }  \r\n                          };<\/pre>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t<h1><span class=\"ez-toc-section\" id=\"Common_errors\"><span style=\"font-weight: 400\">Common errors<\/span><\/span><\/h1>\n<p>Some commonly encountered errors are:<\/p>\n<ul>\n<li><em>A wrong URL<\/em> 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\u2019s web SDK. If its Kore web SDK, then the URL is <code>http:\/\/demo.kore.net:3000\/users\/sts 7<\/code>. If you are hosting on your in-house web SDK, then provide the respective URL.<\/li>\n<li><em>missing\/Invalid jwt.sub():<\/em> This error occurs for enterprise assistants, when the user&#8217;s email id is not given in the index.html file. Provide users identity as shown below in index.html <code>botOptions.userIdentity = \u2018x@gmail.com\u2019;\/\/ Provide users email id here.<\/code><\/li>\n<li><em>Not found:\u00a0<\/em>User sees this error when either wrong clientID or no clientID is given. Check the correct ClientID from Bot \u2013 API Extensions option <code>botOptions.clientId = \u201c{clientID}\u201d; \/\/ secure client-id<\/code>.<\/li>\n<li><em>error verifying the jwt: the\u00a0<\/em>Wrong clientSecret is given in index.html: Check the correct clientSecret you get from Bot \u2013 API Extensions option <code>\u201cclientSecret\u201d: \"{clientSecret}\u201d \/\/provide clientSecret here<\/code>.<\/li>\n<\/ul>\n<p>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.<\/p>\n\r\n\t\t<\/div>\r\n\t<\/div>\r\n<div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"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...","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[197],"tags":[],"class_list":["post-48057","post","type-post","status-publish","format-standard","hentry","category-travel-planing-assistant"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/48057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=48057"}],"version-history":[{"count":7,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/48057\/revisions"}],"predecessor-version":[{"id":53602,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/48057\/revisions\/53602"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=48057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=48057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=48057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}