{"id":17992,"date":"2017-05-04T17:09:42","date_gmt":"2017-05-04T17:09:42","guid":{"rendered":"http:\/\/developer.kore.ai\/v10-1\/?post_type=docs&#038;p=11397"},"modified":"2023-11-09T13:41:54","modified_gmt":"2023-11-09T13:41:54","slug":"kore-ai-botkit-sdk-tutorial","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/sdks\/kore-ai-botkit-sdk-tutorial\/","title":{"rendered":"BotKit SDK Tutorial &#8211; Flight Search Sample Bot"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">This tutorial is an end-to-end walkthrough for setting up and running an instance of the Kore.ai BotKit SDK, which is a collection of libraries that you can use for more control of the messages and webhook events in Kore.ai assistants for your web service. For this tutorial, you will use the sample Flight Search Assistant that you can install, generate authentication tokens, and then test using <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> as a test callback server.<\/span><\/p>\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>\n<h2><span class=\"ez-toc-section\" id=\"Prerequisites\"><span style=\"font-weight: 400;\">Prerequisites<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To complete this tutorial, you will have to setup and configure the following prerequisites:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>Install and run ngrok<\/strong><span style=\"font-weight: 400;\"> as your test callback server. The test callback server application, <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\">, is used to simulate your callback server application.<\/span><\/li>\n<li style=\"font-weight: 400;\"><strong>Install <\/strong><strong><em>node.js<\/em><\/strong><strong> on your computer<\/strong><span style=\"font-weight: 400;\"> (version 10 or above) \u2013 The BotKit SDK requires <\/span><em><span style=\"font-weight: 400;\">node.js<\/span><\/em><span style=\"font-weight: 400;\"> to communicate between your server and the Kore.ai XO Platform.<\/span><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Installing_and_running_ngrok\"><span style=\"font-weight: 400;\">Installing and running <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">To download the test callback server application, click <\/span><a href=\"https:\/\/ngrok.com\/download\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">https:\/\/ngrok.com\/download<\/span><\/a><span style=\"font-weight: 400;\">, and then download and install the <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> file for your operating system.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In a <\/span><strong>Terminal<\/strong><span style=\"font-weight: 400;\"> Window, start <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> to monitor port <\/span><span style=\"font-weight: 400;\">8003<\/span><span style=\"font-weight: 400;\"> using the following command:<\/span><\/p>\n<p><code><span style=\"font-weight: 400;\">ngrok http 8003<\/span><\/code><\/p>\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\/20221005061537\/DIYBotKitSDKNgrok-1-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-48125\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061537\/DIYBotKitSDKNgrok-1-1-1024x327.png\" alt=\"\" width=\"533\" height=\"170\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061537\/DIYBotKitSDKNgrok-1-1-1024x327.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061537\/DIYBotKitSDKNgrok-1-1-300x96.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061537\/DIYBotKitSDKNgrok-1-1.png 1121w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/a><code><\/code><\/p>\n<p><span style=\"font-weight: 400;\">Copy the https <\/span><strong>Forwarding URL<\/strong><span style=\"font-weight: 400;\"> as shown in the previous illustration, for example, <\/span><span style=\"font-weight: 400;\">https:\/\/1b47f1d2.ngrok.io<\/span><span style=\"font-weight: 400;\">. Leave the terminal window open and <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> running.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Installing_nodejs\"><span style=\"font-weight: 400;\">Installing node.js<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The BotKit SDK requires <\/span><em><span style=\"font-weight: 400;\">node.js<\/span><\/em><span style=\"font-weight: 400;\"> (version 10 or above) to run on the same server where the SDK is installed. Go to <\/span><a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">https:\/\/nodejs.org\/en\/download\/<\/span><\/a><span style=\"font-weight: 400;\">, and then select your OS as a <\/span><span style=\"font-weight: 400;\">.pkg<\/span><span style=\"font-weight: 400;\"> file type for Mac, and <\/span><span style=\"font-weight: 400;\">.msi<\/span><span style=\"font-weight: 400;\"> file type for Windows.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In a <\/span><strong>Terminal<\/strong><span style=\"font-weight: 400;\"> window, run the <\/span><code><span style=\"font-weight: 400;\">node -v<\/span><\/code><span style=\"font-weight: 400;\"> command to verify installation and version, for example, <\/span><code><span style=\"font-weight: 400;\">v6.10.2 <\/span><\/code><span style=\"font-weight: 400;\">as shown in the following illustration.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061541\/DIYBotKITSDKTutorialNodeJS-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-48128\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061541\/DIYBotKITSDKTutorialNodeJS-2.png\" alt=\"\" width=\"436\" height=\"93\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061541\/DIYBotKITSDKTutorialNodeJS-2.png 436w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221005061541\/DIYBotKITSDKTutorialNodeJS-2-300x64.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/a><\/span><\/p>\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>\n<h2><span class=\"ez-toc-section\" id=\"Installing_and_Configuring_Your_Assistant\"><span style=\"font-weight: 400;\">Installing and Configuring Your Assistant<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">With the prerequisites installed and running, you are ready to install the <\/span><em><span style=\"font-weight: 400;\">Flight Search Sample<\/span><\/em><span style=\"font-weight: 400;\"> assistant. In this section, you will:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Install the <\/span><em><span style=\"font-weight: 400;\">Flight Search <\/span><\/em><span style=\"font-weight: 400;\">assistant<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Create an App Registration<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Generate Security Credentials<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Install and Configure the BotKit SDK \u2013 config.json and FindAFlight.js files<\/span><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Installing_the_Flight_Search_Assistant\"><span style=\"font-weight: 400;\">Installing the Flight Search Assistant<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Kore.ai provides ready to use sample assistants that you can install into your instance of XO Platform. For this tutorial, you will need to install the <\/span><em><span style=\"font-weight: 400;\">Flight Search <\/span><\/em><span style=\"font-weight: 400;\">assistant.<\/span><\/p>\n<p><strong>To install the Flight Search assistant:<\/strong><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Log on to XO Platform, and then click <\/span><strong>New Bot &gt; Start from the Store<\/strong><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Find the <\/span><strong>Flight Search<\/strong><span style=\"font-weight: 400;\"> assistant and install it.\u00a0<\/span><\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Registering_Your_App_and_Generating_Client_Credentials\"><span style=\"font-weight: 400;\">Registering Your App and Generating Client Credentials<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">To register your BotKit SDK with the Kore.ai XO Platform, you will need to create an app registration, and then generate security credentials used to securely communicate between the SDK installed on your server platform and the Kore.ai XO Platform.<\/span><\/p>\n<p><strong>Creating an App Registration<\/strong><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the XO Platform, go to <\/span><strong>Deploy &gt; Integrations &gt; BotKit<\/strong><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Next to the <\/span><strong>App name <\/strong><span style=\"font-weight: 400;\">drop-down list, click <\/span><strong>Add<\/strong><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Enter a name for the app and then click <\/span><strong>Next<\/strong><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The Client ID and Client Secret details appear. Click <\/span><strong>Done<\/strong><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the <\/span><strong>Callback URL<\/strong><span style=\"font-weight: 400;\"> field, enter the URL for your application that you copied from the <\/span><strong>Forwarding URL<\/strong><span style=\"font-weight: 400;\"> from the <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> application that you installed and ran as part of the prerequisites, for example,\u00a0 <\/span><span style=\"font-weight: 400;\">https:\/\/1b47f1d2.ngrok.io<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><strong><em>Note:<\/em><\/strong><em><span style=\"font-weight: 400;\"> Each running instance of ngrok will generate a session unique URL. You will need to update the <\/span><\/em><strong><em>Callback URL<\/em><\/strong><em><span style=\"font-weight: 400;\"> field if you stop and restart ngrok.<\/span><\/em><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the <\/span><strong>Events<\/strong><span style=\"font-weight: 400;\"> section, select <\/span><strong>OnHookNode<\/strong><span style=\"font-weight: 400;\"> \u2013 An event is triggered when a <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-builder-tool\/dialog-task\/working-with-the-web-hook-node\/\" target=\"_blank\" rel=\"noopener noreferrer\">Webhook node<\/a> is encountered in the dialog task flow.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Click <\/span><strong>Save<\/strong><span style=\"font-weight: 400;\">. The <\/span><em><span style=\"font-weight: 400;\">Successfully subscribed<\/span><\/em><span style=\"font-weight: 400;\"> message is displayed.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">To configure the BotKit SDK settings, you will need to:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Copy the <\/span><strong>Client ID<\/strong><span style=\"font-weight: 400;\">, for example, <\/span><code><span style=\"font-weight: 400;\">cs-6e5eb411-e592-50d9-9ba2-ccc748d4f719<\/span><\/code><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">View, and then copy the <\/span><strong>Client Secret<\/strong><span style=\"font-weight: 400;\">, for example, <\/span><code><span style=\"font-weight: 400;\">dTTmuTOgs8SOCwF\/tFizouE0EPy28fXojOJWedOEF6s=<\/span><\/code><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ul>\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>\n<h2><span class=\"ez-toc-section\" id=\"Publishing_the_Assistant\"><span style=\"font-weight: 400;\">Publishing the Assistant<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A developer can use any installed assistant immediately for testing as it is available to the owner on save. If you only want to run and test this assistant for this tutorial, you can skip to the next section, <\/span><em><span style=\"font-weight: 400;\">Installing and Configuring the BotKit SDK<\/span><\/em><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To enable the assistant for other users, you must publish it so the Admin can approve and deploy the assistant for users. For more information, see <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/publish\/publishing-bot\/#Publishing_Tasks\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">Publishing Your Assistant<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After you publish an assistant in the XO Platform, an Admin must complete one of the following deployments in the Admin Console depending on whether your assistant\u2019s <\/span><strong>Target Audience<\/strong><span style=\"font-weight: 400;\"> is set to <\/span><strong>Enterprise Users<\/strong><span style=\"font-weight: 400;\"> (managed users) or <\/span><strong>General Public<\/strong><span style=\"font-weight: 400;\"> (unmanaged users):<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>For Enterprise Users<\/strong>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the Admin Console, in the <\/span><strong>Bots Management<\/strong><span style=\"font-weight: 400;\"> module, on the <\/span><strong>Enterprise Bots<\/strong><span style=\"font-weight: 400;\"> page, click the <\/span><strong>Ellipses<\/strong><span style=\"font-weight: 400;\"> icon for the <\/span><em><span style=\"font-weight: 400;\">Agent Transfer<\/span><\/em><span style=\"font-weight: 400;\"> bot that you want to deploy, and then click <\/span><strong>Manage bot tasks<\/strong><span style=\"font-weight: 400;\">. The <\/span><strong>Manage Bot Tasks<\/strong><span style=\"font-weight: 400;\"> dialog is displayed.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Expand the <\/span><strong>Bot Tasks<\/strong> <span style=\"font-weight: 400;\">field to view the available and deployed tasks.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Select all tasks of the bot and then click <\/span><strong>Confirm<\/strong><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the <\/span><strong>Manage bot tasks<\/strong><span style=\"font-weight: 400;\"> dialog, click <\/span><strong>Confirm<\/strong><span style=\"font-weight: 400;\">. The <\/span><em><span style=\"font-weight: 400;\">Bot status changed successfully<\/span><\/em><span style=\"font-weight: 400;\"> message is displayed.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the <\/span><strong>Enterprise Bots<\/strong><span style=\"font-weight: 400;\"> page, click the <\/span><strong>Ellipses<\/strong><span style=\"font-weight: 400;\"> icon for the <\/span><em><span style=\"font-weight: 400;\">Flight Search assistant <\/span><\/em><span style=\"font-weight: 400;\">that you want to assign enterprise users to, and then click <\/span><strong>Bot &amp; task assignments<\/strong><span style=\"font-weight: 400;\">. The <\/span><strong>Bot &amp; task assignments<\/strong><span style=\"font-weight: 400;\"> dialog is displayed.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Assign the assistant to the selected users in the enterprise.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\"><strong>For General Public Users<\/strong>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">In the Admin Console, in the <\/span><strong>Bots Management<\/strong><span style=\"font-weight: 400;\"> module, on the <\/span><strong>Consumer Bots<\/strong><span style=\"font-weight: 400;\"> page, click the <\/span><strong>Ellipses<\/strong><span style=\"font-weight: 400;\"> icon for the <\/span><em><span style=\"font-weight: 400;\">Agent Transfer<\/span><\/em><span style=\"font-weight: 400;\"> bot that you want to deploy, and then click <\/span><strong>Manage bot tasks<\/strong><span style=\"font-weight: 400;\">. The <\/span><strong>Manage Bot Tasks<\/strong><span style=\"font-weight: 400;\"> dialog is displayed.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Expand the <\/span><strong>Bot Tasks<\/strong><span style=\"font-weight: 400;\"> field to view the available and deployed tasks.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Select all tasks of the assistant and then click <\/span><strong>Confirm<\/strong><span style=\"font-weight: 400;\">. The <\/span><em><span style=\"font-weight: 400;\">Bot status changed successfully<\/span><\/em><span style=\"font-weight: 400;\"> message is displayed.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Installing_and_Configuring_the_BotKit_SDK\"><span style=\"font-weight: 400;\">Installing and Configuring the BotKit SDK<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">You will need to download and then uncompress the Kore.ai BotKit SDK from <\/span><a href=\"https:\/\/github.com\/Koredotcom\/BotKit\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">https:\/\/github.com\/Koredotcom\/BotKit<\/span><\/a><span style=\"font-weight: 400;\">. Be sure to download the latest version that contains the <\/span><span style=\"font-weight: 400;\">LiveChat.js<\/span><span style=\"font-weight: 400;\"> files.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Editing_configjson\"><span style=\"font-weight: 400;\">Editing config.json<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">In your BotKit SDK folder, you will need to edit the <\/span><span style=\"font-weight: 400;\">config.json<\/span><span style=\"font-weight: 400;\"> file that contains the connection information to your callback server. For this tutorial, you are using <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\">, along with the security credentials generated when you created the app registration for the <\/span><em><span style=\"font-weight: 400;\">Flight Search <\/span><\/em><span style=\"font-weight: 400;\">assistant, and adding a new line to <\/span><span style=\"font-weight: 400;\">config.json<\/span><span style=\"font-weight: 400;\"> file that contains the license key for your <\/span><em><span style=\"font-weight: 400;\">LiveChat<\/span><\/em><span style=\"font-weight: 400;\"> agent application.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Modify the default <\/span><span style=\"font-weight: 400;\">config.json<\/span><span style=\"font-weight: 400;\"> file for the following parameters as follows:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><code><span style=\"font-weight: 400;\">url<\/span><\/code><span style=\"font-weight: 400;\"> \u2013 Add this parameter with the <\/span><strong>Forwarding URL<\/strong><span style=\"font-weight: 400;\"> field from <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><\/li>\n<li style=\"font-weight: 400;\"><code><span style=\"font-weight: 400;\">apikey<\/span><\/code><span style=\"font-weight: 400;\"> \u2013 Update parameter using <\/span><strong>Client Secret<\/strong><\/li>\n<li style=\"font-weight: 400;\"><code><span style=\"font-weight: 400;\">appId<\/span><\/code><span style=\"font-weight: 400;\"> \u2013 Update parameter using <\/span><strong>Client ID<\/strong><\/li>\n<\/ul>\n<pre><span style=\"font-weight: 400;\">{\r\n\"server\": {\r\n\"port\": 8003\r\n},\r\n\"app\": {\r\n\"apiPrefix\" : \"\",\r\n\"url\": \"&lt; ngrok Forwarding URL &gt;\"\r\n},\r\n\"credentials\": {\r\n\"apikey\": \"&lt; Client Secret from XO Platform &gt;\",\r\n\"appId\": \"&lt; Client ID from XO Platform &gt;\"\r\n},\r\n\"redis\": {\r\n\"options\": {\r\n\"host\": \"localhost\",\r\n\"port\": 6379\r\n},\r\n\"available\": false\r\n},\r\n\"examples\" : {\r\n\"mockServicesHost\" : \"http:\/\/localhost:8004\"\r\n}\r\n}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The following code is an example of a fully defined sample <\/span><span style=\"font-weight: 400;\">config.json<\/span><span style=\"font-weight: 400;\"> file:<\/span><\/p>\n<pre>{\r\n\"server\": {\r\n\"port\": 8003\r\n},\r\n\"app\": {\r\n\"apiPrefix\" : \"\",\r\n\"url\": \"https:\/\/1b47f1d2.ngrok.io\"\r\n},\r\n\"credentials\": {\r\n\"apikey\": \"dTTmuTOgs8SOCwXXXXXXXXE0EPy28fXojOJWedOEF6s=\",\r\n\"appId\": \"cs-6e5eb411-XXXX-XXXX-9ba2-ccc748d4f719\"\r\n},\r\n\"redis\": {\r\n\"options\": {\r\n\"host\": \"localhost\",\r\n\"port\": 6379\r\n},\r\n\"available\": false\r\n},\r\n\"examples\" : {\r\n\"mockServicesHost\" : \"http:\/\/localhost:8004\"\r\n}\r\n}<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"FindAFlightjs\"><span style=\"font-weight: 400;\">FindAFlight.js<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">The <\/span><a href=\"https:\/\/github.com\/Koredotcom\/BotKit\/blob\/master\/FindAFlight.js\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">FindAFlight.js<\/span><\/a><span style=\"font-weight: 400;\"> file in the BotKit SDK contains the JavaScript that handles the webhook call for flight information. For this tutorial, you will configure the webhook settings with the following information:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the XO Platform, select the <\/span><em><span style=\"font-weight: 400;\">Flight Search <\/span><\/em><span style=\"font-weight: 400;\">assistant, and then on the <\/span><strong>Settings -&gt; Config Settings<\/strong><span style=\"font-weight: 400;\"> section, select the <\/span><strong>General Settings<\/strong><span style=\"font-weight: 400;\"> section. The <\/span><strong>General Settings <\/strong><span style=\"font-weight: 400;\">page is displayed. Copy the:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><strong>Bot Name<\/strong><span style=\"font-weight: 400;\"> \u2013 The name of the assistant on the XO Platform, for example, <\/span><em><span style=\"font-weight: 400;\">Flight Search Sample Tutorial<\/span><\/em><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><strong>Bot ID<\/strong><span style=\"font-weight: 400;\"> \u2013 The XO Platform system has a unique ID for the assistant, for example, <\/span><em><span style=\"font-weight: 400;\">st-26cfae3a-XXXX-XXXX-991a-376b7fe579d5<\/span><\/em><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">In the <\/span><a href=\"https:\/\/github.com\/Koredotcom\/BotKit\/blob\/master\/FindAFlight.js\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400;\">FindAFlight.js<\/span><\/a><span style=\"font-weight: 400;\"> file, update and save the following case-sensitive variables with the settings from your assistant\u2019s instance:<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><code>var botId<\/code> = &#8220;&lt; <\/span><strong><em>Bot ID<\/em><\/strong><span style=\"font-weight: 400;\"> &gt;&#8221;;<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><code>var botName<\/code> = &#8220;&lt; <\/span><strong><em>Bot Name<\/em><\/strong><em><span style=\"font-weight: 400;\"> &gt;<\/span><\/em><span style=\"font-weight: 400;\">&#8220;;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For example:<\/span><\/p>\n<p><code><span style=\"font-weight: 400;\">var botId = \"<\/span><em><span style=\"font-weight: 400;\">st-26cfae3a-XXXX-XXXX-991a-376b7fe579d5<\/span><\/em><span style=\"font-weight: 400;\">\";<br \/>\n<\/span><span style=\"font-weight: 400;\">var botName = \"<\/span><em><span style=\"font-weight: 400;\">Flight Search Sample Tutorial<\/span><\/em><span style=\"font-weight: 400;\">\";<\/span><\/code><\/p>\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>\n<h2><span class=\"ez-toc-section\" id=\"Starting_the_BotKit_SDK_Application\"><span style=\"font-weight: 400;\">Starting the BotKit SDK Application<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To start using the <\/span><em><span style=\"font-weight: 400;\">Flight Search <\/span><\/em><span style=\"font-weight: 400;\">assistant using the BotKit SDK, <\/span><em><span style=\"font-weight: 400;\">node.js<\/span><\/em><span style=\"font-weight: 400;\"> must be installed and <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> running listening on port <\/span><span style=\"font-weight: 400;\">8003<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><strong>To start BotKit SDK<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">In a <\/span><strong>Terminal<\/strong><span style=\"font-weight: 400;\"> window, navigate to your BotKit SDK folder, and then enter the following command:<\/span><\/p>\n<p><code><span style=\"font-weight: 400;\">node app.js<\/span><\/code><\/p>\n<p><span style=\"font-weight: 400;\">When <\/span><em><span style=\"font-weight: 400;\">node.js<\/span><\/em><span style=\"font-weight: 400;\"> is running, you should get the following response:<\/span><\/p>\n<p><code><span style=\"font-weight: 400;\">app listening at <a href=\"http:\/\/:::8003\">http:\/\/:::8003<\/a><\/span><\/code><\/p>\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>\n<h2><span class=\"ez-toc-section\" id=\"Testing_the_BotKit_SDK_Bot\"><span style=\"font-weight: 400;\">Testing the BotKit SDK Bot<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To test your assistant, you need the following:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\"> running \u2013 Command = <\/span><code><span style=\"font-weight: 400;\">ngrok http 8003<\/span><\/code><\/li>\n<li style=\"font-weight: 400;\"><em><span style=\"font-weight: 400;\">node.js<\/span><\/em><span style=\"font-weight: 400;\"> running \u2013 Command = <\/span><code><span style=\"font-weight: 400;\">node app.js<\/span><\/code><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">XO Platform \u2013 Start <\/span><em><span style=\"font-weight: 400;\">Talk to Bot<\/span><\/em><span style=\"font-weight: 400;\"> by clicking the following icon on the bottom right corner of any XO Platform page:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">After the Flight Search Sample dialog is started, messages are exchanged between the third-party webhook as a web service and the BotKit SDK.<\/span><\/p>\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>\n<h2><span class=\"ez-toc-section\" id=\"Next_Steps\"><span style=\"font-weight: 400;\">Next Steps<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To use the Kore.ai assistant in your application, you would need to configure the BotKit SDK and register your application with <\/span><strong>CallBack URL<\/strong><span style=\"font-weight: 400;\"> to point to your company application server instead of <\/span><em><span style=\"font-weight: 400;\">ngrok<\/span><\/em><span style=\"font-weight: 400;\">. And of course, to share the assistant with other users, the Enterprise Admin for your company would need to approve and deploy the assistant to those users after you publish.<\/span><\/p>\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>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial is an end-to-end walkthrough for setting up and running an instance of the Kore.ai BotKit SDK, which is a collection of libraries that you can use for more control of the messages and webhook events in Kore.ai assistants for your web service. For this tutorial, you will use the sample Flight Search Assistant&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-17992","post","type-post","status-publish","format-standard","hentry","category-sdks"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/17992","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=17992"}],"version-history":[{"count":12,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/17992\/revisions"}],"predecessor-version":[{"id":60077,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/17992\/revisions\/60077"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=17992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=17992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=17992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}