{"id":18058,"date":"2018-08-24T11:29:43","date_gmt":"2018-08-24T11:29:43","guid":{"rendered":"https:\/\/developer.kore.ai\/v8-1\/?post_type=docs&#038;p=15176"},"modified":"2021-03-17T10:44:03","modified_gmt":"2021-03-17T10:44:03","slug":"apis","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v8-1\/docs\/bots\/api-guide\/apis\/","title":{"rendered":"Using Kore.ai APIs"},"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>Kore.ai Bots Platform provides access to bot development using secured APIs. All key developer activities like bot creation, bot import and export, training, and publishing are available using these APIs. Key account management activities like managing Bot Builder access, managing admin, and bot roles can also be performed via secured public APIs. For a complete list of APIs and usage instructions <a href=\"\/v8-1\/docs\/bots\/api-guide\/api-list\/\" target=\"_blank\" rel=\"noopener noreferrer\">refer here<\/a>.<\/p>\n<p>Authentication of the API requests involves the following two steps:<\/p>\n<ol>\n<li><strong>Creating an App<\/strong>: As a part of creating the app, you need to select the API scopes for the App, which allows you to provide access to only the selected APIs to the app.\n<ul>\n<li><strong>Bot Builder API Scopes<\/strong>: Bot developers can define bot specific API Scopes from the Bot Builder tool.<\/li>\n<li><strong>Bot Admin Console API Scopes<\/strong>: Account administrators can define API Scopes to access any of the bots built in their accounts from the Admin Console.<\/li>\n<\/ul>\n<\/li>\n<li><b>Associate API Scopes to an App<\/b>: To allow a client application to access the Bots Platform APIs, you need to associate the client app with the bot.<\/li>\n<\/ol>\n<p>Additionally, you can secure the connections with the platform by the following methods:<\/p>\n<ol>\n<li><strong>Enforce JTI Claim<\/strong> &#8211; Once enabled, the platform would accept the requests only from calls with the JTI Claim in the requests and those without JTI Claim would be rejected<\/li>\n<li><strong>Enforce JWE Encryption<\/strong>&#8211;\u00a0Generating JWT token: To access Bot Platform\u2019s public APIs, the application making the API request requires authentication. Kore.ai uses the JWT (JSON Web Token) mechanism to handle the authentication. For a quick overview of the JWT token, read <a href=\"https:\/\/jwt.io\/introduction\/\" target=\"_blank\" rel=\"noopener noreferrer\">Introduction to JWT tokens<\/a>.<br \/>\nUse the Client ID and Client Secret of the client app from above to generate a JWT token. This token needs to be passed as a part of each API request for authorization.<\/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=\"Creating_Managing_Apps\">Creating &amp; Managing Apps<\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"Bot_Builder\">Bot Builder<\/span><\/h3>\n<p>Following steps let you create a Client App from the Bot Builder:<\/p>\n<ol>\n<li>Hover over the side-navigation panel of the bot and click <b>API Extensions<\/b>.<\/li>\n<li>On the API Extensions page, click the <b>Manage Apps<\/b> tab and then click <b>New App<\/b>.<\/li>\n<li>On the Create Client App page:\n<ol>\n<li>enter a <em>name<\/em> for the app,<\/li>\n<li>enforce JTI and\/or JWE as per your requirements<\/li>\n<\/ol>\n<\/li>\n<li>Click <strong>Next<\/strong> and\u00a0<strong>Done<\/strong>.<\/li>\n<li>You will be directed to the Manage Apps page, where all the apps associated with this Bot will be displayed.<\/li>\n<li>Once you select an app, the Client ID and Client Secret section appear. Also displayed will be a list of places where this app is used like web SDK, bot kit SDK, etc.<\/li>\n<li>You can also use this screen to\u00a0<strong>delete<\/strong> apps by using the trash icon against the respective app. Note, only the Bot Owner can delete an app.<\/li>\n<\/ol>\n<p><strong>Note<\/strong>: Before the release of ver 7.3 of the platform, apps were associated with the user. The apps are associated with a bot since the release of ver 7.3 of the platform.\u00a0 Bot developers, other than the bot owner, with <em>Apps and Scopes<\/em> permission, will have access to these apps. To ensure backward compatibility, if an app is being used in more than one bot, then the app will be duplicated with the same credentials for each of these bots.<\/p>\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<h3><span class=\"ez-toc-section\" id=\"Bot_Admin_Console\">Bot Admin Console<\/span><\/h3>\n<p>Following steps let you create a Client App from the Bot Admin Console:<\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the side-navigation panel of the Bots Admin homepage, click <\/span><b>Security &amp; Control &gt; API Scopes<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the API Scopes page, click <\/span><b>New<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">To create a new app, click the<\/span><b> Manage Apps <\/b><span style=\"font-weight: 400;\">link.<\/span><\/li>\n<li>Click <strong>New App<\/strong>,\n<ol>\n<li>enter a name and<\/li>\n<li>enforce JTI and\/or JWE as per your requirements<\/li>\n<\/ol>\n<\/li>\n<li>Click<strong> Save<\/strong>.<\/li>\n<\/ol>\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<h3><span class=\"ez-toc-section\" id=\"Data_Table\">Data Table<\/span><\/h3>\n<p>The Data table option has been added to the platform in v7.3 of the platform (<a href=\"\/v8-1\/docs\/bots\/advanced-topics\/data-as-a-service\/\" target=\"_blank\" rel=\"noopener noreferrer\">see here for more<\/a>). Access control to these would be different from the Bot Builder and Bot Admin Console access controls.<\/p>\n<p>You can define apps to securely access the data from data tables and data views.<\/p>\n<ul>\n<li>You can create one or more apps and they would be owned by you, <a href=\"\/v8-1\/docs\/bots\/advanced-topics\/data-as-a-service\/#App_Definition\" target=\"_blank\" rel=\"noopener noreferrer\">see here for how<\/a>.<\/li>\n<li>These apps can be used for:\n<ul>\n<li>Accessing the data tables and views over public APIs<\/li>\n<li>Accessing the data tables and views using Service Node<\/li>\n<li>Accessing the export and import API for the definition of data table and views<\/li>\n<\/ul>\n<\/li>\n<li>You can grant this app read, write, and delete permissions to each table and view separately, <a href=\"\/v8-1\/docs\/bots\/advanced-topics\/data-as-a-service\/#Assignments\" target=\"_blank\" rel=\"noopener noreferrer\">see here for more<\/a>.<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/DaaS-apps.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23673\" src=\"\/wp-content\/uploads\/sites\/18\/DaaS-apps.png\" alt=\"\" width=\"1363\" height=\"513\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/18\/20221201100208\/DaaS-apps.png 1363w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/18\/20221201100208\/DaaS-apps-300x113.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/18\/20221201100208\/DaaS-apps-1024x385.png 1024w\" sizes=\"auto, (max-width: 1363px) 100vw, 1363px\" \/><\/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=\"Associating_API_Scopes\">Associating API Scopes<\/span><\/h2>\n<p>Once created a client app needs to be associated with API scopes.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Bot_Builder-2\">Bot Builder<\/span><\/h3>\n<p>Following steps let you associate API Scopes to a Client App from the Bot Builder:<\/p>\n<ol>\n<li>Hover over the side-navigation panel of the bot and click <b>API Extensions<\/b>.<\/li>\n<li>On the API Extensions page, click the <b>API Scopes<\/b> tab and then click <b>New<\/b>.<\/li>\n<li>On the New API Scope Mapping page, from the <b>App <\/b>drop-down list, select an existing client app for authentication.<\/li>\n<li>Once you select an app, the Client ID and Client Secret section appear. You can copy the values.<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/18\/API-Scopes-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-15177\" src=\"\/wp-content\/uploads\/sites\/18\/API-Scopes-1.png\" alt=\"\" width=\"365\" height=\"474\" \/><\/a><\/li>\n<li>Under the Scopes section, select the APIs for which you want the client app to have access. The apps cannot access the APIs that aren\u2019t selected here. The following are the list of scopes that can be selected:\n<ul>\n<li>Intent and Entity Detection &#8211; to allow intent and entity detection from an utterance using secured APIs<\/li>\n<li>Chat History &#8211; to retrieve chat transcripts of this bot using secured APIs<\/li>\n<li>Debug Logs &#8211; to retrieve debug logs of this bot using secured APIs<\/li>\n<li>Bot Export &#8211; to export the definition of a selected bot<\/li>\n<li>Import Variables &#8211; to import variables of this bot using secured APIs<\/li>\n<li>Export Variables &#8211; to export variables of this bot using secured APIs<\/li>\n<li>Train ML &#8211; to match a given utterance against the NL model to identify possible intents and entities present in the utterance<\/li>\n<li>Train Faq &#8211; to match a given faq against the faq model<\/li>\n<li>Utterances Import &#8211; to import utterances for a bot task<\/li>\n<li>Utterances Export &#8211; to export utterances for a bot task<\/li>\n<li>Logs History &#8211; to retrieve the change logs for the particular bot<\/li>\n<li>Bot Sessions &#8211; to retrieve bot conversation sessions<\/li>\n<li>Custom Reports &#8211; to retrieve the data associated with custom widgets and reports<\/li>\n<li>RCS Message Events &#8211; for opting in users to RCS Business Messaging channel and sending broadcast messages<\/li>\n<li>Link External Bots &#8211; to allow linking of child bots which are not part of this account<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>NOTE<\/strong>: Once enabled, the API Scopes need to be Published. <a href=\"\/v8-1\/docs\/bots\/bot-builder-tool\/publish\/publishing-bot\/#Publishing_Tasks\" target=\"_blank\" rel=\"noopener noreferrer\">Follow the Publish<\/a> procedure ensuring that the API Scopes are selected from the API Extensions option.<\/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<h3><span class=\"ez-toc-section\" id=\"Bot_Admin_Console-2\">Bot Admin Console<\/span><\/h3>\n<p>Following steps let you associate API Scopes to a Client App from the Bot Admin Console:<\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the side-navigation panel of the Bots Admin homepage, click <\/span><b>Security &amp; Control &gt; API Scopes<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the API Scopes page, click <\/span><b>New<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">On the New API Scope Mapping page, from the <\/span><b>App <\/b><span style=\"font-weight: 400;\">drop-down list, select an existing client app for authentication. To create a new app, click the<\/span><b> Manage Apps <\/b><span style=\"font-weight: 400;\">link. <\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Once you select an app, the <\/span><i><span style=\"font-weight: 400;\">Client ID and Client Secret<\/span><\/i><span style=\"font-weight: 400;\"> section appear. Copy the values.<\/span><\/li>\n<li>You can also use this screen to\u00a0<strong>delete<\/strong> apps by using the trash icon against the respective app.<\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Under the Scopes section, select the APIs for which you want the client app to have access.<br \/>\n<a href=\"\/v8-1\/docs\/bots\/bot-admin\/security-control\/security-module-overview\/#API_Scopes\">Refer here for the list of API scopes<\/a>.<\/span><\/li>\n<\/ol>\n<h3><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-15659 aligncenter\" src=\"\/wp-content\/uploads\/sites\/18\/Admin-Console-App-Scopes-276x300.png\" alt=\"\" width=\"276\" height=\"300\" \/><\/h3>\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=\"Generating_JWT_Token\">Generating JWT Token<\/span><\/h2>\n<p>Once you have associated the API scopes to a client app, you need to generate the JWT token for API requests.<\/p>\n<ol>\n<li>You can use the following link to generate the token. <a href=\"\/tools\/jwt\/\" target=\"_blank\" rel=\"noopener noreferrer\">Click here<\/a>.<\/li>\n<li>Select the algorithm you want to use to generate the token &#8211; HS256 or RS256<\/li>\n<li>Scroll down to the Decoded section.<\/li>\n<li>Replace the contents in the <b>Payload <\/b>box with the Client ID of the app copied in the previous section.\n<pre>{ \r\n  \"appId\": \"your-client-id-here\" \r\n}<\/pre>\n<div class=\"alert alert-info\">Note: The Bot Builder validates the token only when it is generated exactly as \u201cappId\u201d. The platform doesn&#8217;t validate tokens generated with any other formats such as \u201cApp ID\u201d \u201cappid\u201d or \u201capp ID\u201d.<\/div>\n<\/li>\n<li>In the <strong>Verify Signature<\/strong> box,\n<ul>\n<li>for HS256 encoding enter the Client Secret copied from the previous section in the box with the text <b>your-256-bit-secret<\/b>.<\/li>\n<li>for RS256 encoding enter the public and private keys in the corresponding text areas.<br \/>\nNote: your key must be pasted within the Begin and End tags.<\/li>\n<\/ul>\n<\/li>\n<li>Copy the generated JWT token from the Encoded section on the top or use the <strong>Copy JWT<\/strong> button at the bottom.<\/li>\n<li>This token can be used to access the required API and it needs to be passed as a part of each API request for authorization.<\/li>\n<li>You can use the API Collection to test the APIs from your Postman setup. <a href=\"\/v8-1\/docs\/bots\/api-guide\/api-collection\/\" target=\"_blank\" rel=\"noopener noreferrer\">See here for more<\/a>.<\/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><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"Kore.ai Bots Platform provides access to bot development using secured APIs. All key developer activities like bot creation, bot import and export, training, and publishing are available using these APIs. Key account management activities like managing Bot Builder access, managing admin, and bot roles can also be performed via secured public APIs. For a complete...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-18058","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/18058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/comments?post=18058"}],"version-history":[{"count":17,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/18058\/revisions"}],"predecessor-version":[{"id":26894,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/posts\/18058\/revisions\/26894"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/media?parent=18058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/categories?post=18058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v8-1\/wp-json\/wp\/v2\/tags?post=18058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}