{"id":29307,"date":"2021-08-02T10:59:29","date_gmt":"2021-08-02T09:59:29","guid":{"rendered":"https:\/\/multisite.korebots.com\/v9-0\/?p=29307"},"modified":"2021-08-02T11:04:21","modified_gmt":"2021-08-02T10:04:21","slug":"data-as-service","status":"publish","type":"post","link":"https:\/\/multisite.korebots.com\/v9-0\/docs\/bots\/bot-builder-tool\/dialog-task\/data-as-service\/","title":{"rendered":"Data as Service"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_grid cols_1 laptops-cols_inherit tablets-cols_inherit mobiles-cols_1 valign_top type_default stacking_default\"><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>Kore.ai&#8217;s Data offering lets you define Data Tables, Table Views, and manipulate them from your Virtual Assistant. This section deals with the manipulation aspect using the <a href=\"\/docs\/bots\/bot-builder-tool\/dialog-task\/working-with-the-service-node\/\" target=\"_blank\" rel=\"noopener noreferrer\">Service Node<\/a> within a Dialog Task of your Virtual Assistant. For details on the data definition, <a href=\"\/docs\/bots\/advanced-topics\/data-as-a-service\/\" target=\"_blank\" rel=\"noopener noreferrer\">refer here<\/a>.<\/p>\n<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h2><span class=\"ez-toc-section\" id=\"Service_Call_%E2%80%93_Table\"><\/span>Service Call &#8211; Table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>From the assigned bots for any given data table\/table view, you can query and manipulate the data using the Service Node in the Dialog Tasks.<\/p>\n<p><strong>Steps to configure the Service node:<\/strong><\/p>\n<ol>\n<li>Open the Bot and the Dialog Task where you want to access the data.<\/li>\n<li>Add a Service Node at the appropriate location in the process flow.<\/li>\n<li><a href=\"\/docs\/bots\/bot-builder-tool\/dialog-task\/working-with-the-service-node\/\" target=\"_blank\" rel=\"noopener noreferrer\">Click here<\/a> for details on Service Node. Here we will be listing the configurations for Data Table integration.<\/li>\n<li>Component Properties configuration\n<ul>\n<li><strong>General Settings<\/strong> section\n<ul>\n<li><strong>Name<\/strong> &#8211; enter a name for the node;<\/li>\n<li><strong>Display Name<\/strong> &#8211; enter a display name for the node;<\/li>\n<li><strong>Service Type<\/strong> &#8211; choose <em>Data Service<\/em>;<\/li>\n<li><strong>Type<\/strong> &#8211; select <em>Table<\/em>.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125941\/data_SN_request.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28034\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125941\/data_SN_request.png\" alt=\"\" width=\"459\" height=\"643\" \/><\/a><\/p>\n<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p><strong>Request Definition<\/strong> &#8211; define the service request by clicking the <em>Define Request<\/em> link. In the slide-out page configure the following:<\/p>\n<ul>\n<li><strong>Choose a Data Table<\/strong> &#8211; You can choose from the list, these are the data tables assigned to this bot.<\/li>\n<li><strong>Actions<\/strong> &#8211; Select the action you would like to perform:\n<ul>\n<li><em>Add Data<\/em> &#8211; to add data (<a href=\"#Add_Data\">see below for details<\/a>);<\/li>\n<li><em>Get Data<\/em> &#8211; to fetch data from the table (<a href=\"#Get_Data\">see below for details<\/a>;<\/li>\n<li><em>Update Data<\/em> &#8211; to modify existing data (<a href=\"#Update_Data\">see below for details<\/a>);<\/li>\n<li><em>Delete data<\/em> &#8211; to delete rows from the data table (<a href=\"#Delete_data\">see below for details<\/a>).<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130048\/data_SN_actions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28036\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130048\/data_SN_actions.png\" alt=\"\" width=\"487\" height=\"647\" \/><\/a><\/li>\n<li>You can <strong>Test<\/strong> the service request. Remember testing with context reference will fail as they will be evaluated at run time and the data will not be available till then.<\/li>\n<li><strong>Save<\/strong> the service request definition<\/li>\n<li>You can set the Instance and Connections properties as per your bot requirements.<\/li>\n<li>The data returned from the data table can be accessed from the context object and used in your task as per your need.<\/li>\n<\/ul>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Add_Data\"><\/span>Add Data<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To add data, you need to:<\/p>\n<ul>\n<li>provide values for each column in the data table;<\/li>\n<li>these values can be static or a reference to a context object\u00a0 for example <code>{{context.entities.&lt;entity-name&gt;}}<\/code><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130125\/data_SN_add.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28038\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130125\/data_SN_add.png\" alt=\"\" width=\"945\" height=\"571\" \/><\/a><\/li>\n<li>The response from this call would be:\n<pre>  \"stringTable\": {\r\n    \"response\": {\r\n      \"body\": {\r\n        \"CustId\": 1,\r\n        \"Type\": \"Preferred\",\r\n        \"Address\": \"New York\",\r\n        \"CustomerName\": \"John Smith\",\r\n        \"Updated_On\": 1593687904111,\r\n        \"Created_On\": 1593687904111,\r\n        \"Updated_By\": \"st-b1376ff2-1111-1111-aa34-973ef73212f5\",\r\n        \"Created_By\": \"st-b1376ff2-1111-1111-aa34-973ef73212f5\",\r\n        \"sys_Id\": \"sys-5c46e351-ee51-5c27-80cf-c6c1e8f8f066\",\r\n        \"_id\": \"5efdbf602de5bb5f3f54f728\"\r\n      }\r\n    }\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Get_Data\"><\/span>Get Data<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To filter and fetch data from the table, you can:<\/p>\n<ul>\n<li><strong>Choose Filters<\/strong> to define filter criteria using:\n<ul>\n<li>the column names &#8211; pick from the drop-down list;<\/li>\n<li>an operator &#8211; choose from the list;<\/li>\n<li>comparison value &#8211; these values can be static or a reference to a context object\u00a0 for example <code>{{context.entities.&lt;entity-name&gt;}}<\/code>.<\/li>\n<li>Multiple filter criteria can be defined using AND\/OR connectors.<\/li>\n<li>In the absence of filter criteria, all rows are fetched limited by the limit and offset values mentioned below.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Limit<\/strong> property can be used to set a limit on the number of records to be fetched. If not specified then 10 records would be fetched by default;<\/li>\n<li><strong>Offset<\/strong> property can be used to specify the records to be skipped from the result data set.<a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130246\/data_SN_get.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28040\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130246\/data_SN_get.png\" alt=\"\" width=\"1293\" height=\"741\" \/><\/a><\/li>\n<li>Data values can be accessed using: <code>{{context.&lt;service_node_name&gt;.response.body.queryResult[&lt;index&gt;].&lt;column_name&gt;}}<\/code><\/li>\n<li>The response from this service call would be:\n<pre>\"customerdetails\": {\r\n    \"response\": {\r\n      \"body\": {\r\n\t\"hasMore\": true,\r\n\t\"total\": 4,\r\n\t\"metaInfo\": [\r\n          {\r\n            \"name\": \"City\",\r\n            \"type\": \"string\"\r\n          },\r\n          {\r\n            \"name\": \"Name\",\r\n            \"type\": \"string\"\r\n          },\r\n          {\r\n            \"name\": \"sys_Id\",\r\n            \"type\": \"string\"\r\n          },\r\n          {\r\n            \"name\": \"Created_On\",\r\n            \"type\": \"date\"\r\n          },\r\n          {\r\n            \"name\": \"Updated_On\",\r\n            \"type\": \"date\"\r\n          },\r\n          {\r\n            \"name\": \"Created_By\",\r\n            \"type\": \"string\"\r\n          },\r\n          {\r\n            \"name\": \"Updated_By\",\r\n            \"type\": \"string\"\r\n          }\r\n        ],\r\n        \"queryResult\": [\r\n          {\r\n            \"CustId\": 1,\r\n            \"Type\": \"Preferred\",\r\n            \"Address\": \"New York\",\r\n            \"CustomerName\": \"John Smith\",\r\n            \"sys_Id\": \"sys-b088ab59-7640-5a8f-8999-61a265dd2bee\",\r\n            \"Created_On\": 1593152119161,\r\n            \"Updated_On\": 1593152119161,\r\n            \"Created_By\": \"st-b1376ff2-2384-5541-aa34-973ef73212f5\",\r\n            \"Updated_By\": \"st-b1376ff2-2384-5541-aa34-973ef73212f5\"\r\n          },\r\n          {\r\n            \"CustId\": 2,\r\n            \"Type\": \"Privileged\",\r\n            \"Address\": \"Chicago\",\r\n            \"CustomerName\": \"Jane Doe\",\r\n            \"sys_Id\": \"sys-632c69ef-f6dd-5d83-ab32-f7837c8b63f9\",\r\n            \"Created_On\": 1593152443035,\r\n            \"Updated_On\": 1593152443035,\r\n            \"Created_By\": \"st-b1376ff2-2384-5541-aa34-973ef73212f5\",\r\n            \"Updated_By\": \"st-b1376ff2-2384-5541-aa34-973ef73212f5\"\r\n          }\r\n\t ]\r\n      }\r\n    }\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Update_Data\"><\/span>Update Data<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To modify existing you can:<\/p>\n<ul>\n<li><strong>Assign Values <\/strong>against each column to be updated.<br \/>\nIf any value is left blank, then the corresponding column original values will NOT be retained but will be set as empty.<\/li>\n<li>These values can be static or a reference to a context object.<\/li>\n<li><strong>Choose Filters <\/strong>to define the <em>filter criteria<\/em> to specify the rows to be updated using\n<ul>\n<li>the column names,<\/li>\n<li>an operator and<\/li>\n<li>filter value &#8211; these values can be static or a reference to a context object\u00a0 for example <code>{{context.entities.&lt;entity-name&gt;}}<\/code>.<\/li>\n<li>Multiple filter criteria can be defined using AND\/OR connectors.<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130419\/data_SN_update.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28042\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130419\/data_SN_update.png\" alt=\"\" width=\"1303\" height=\"759\" \/><\/a><\/li>\n<li>The response from this service call would be:\n<pre>  \"customerdetails\": {\r\n    \"response\": {\r\n      \"body\": {\r\n        \"records\": []\r\n      }\r\n    }\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h3><span class=\"ez-toc-section\" id=\"Delete_data\"><\/span>Delete data<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To delete rows from the data table you need<\/p>\n<ul>\n<li>to define filter criteria to specify the rows to be deleted using\n<ul>\n<li>the column names,<\/li>\n<li>an operator and<\/li>\n<li>filter value, these values can be static or a reference to a context object\u00a0 for example <code>{{context.entities.&lt;entity-name&gt;}}<\/code>. Multiple filter criteria can be defined using AND\/OR connectors.<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130500\/data_SN_delete.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28044\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624130500\/data_SN_delete.png\" alt=\"\" width=\"1307\" height=\"541\" \/><\/a><\/li>\n<li>The response from this service request would be:\n<pre>  \"customerdetails\": {\r\n    \"response\": {\r\n      \"body\": {\r\n        \"nDeleted\": 1\r\n      }\r\n    }\r\n  }<\/pre>\n<\/li>\n<\/ul>\n<\/div><\/div><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 class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h2><span class=\"ez-toc-section\" id=\"Service_Call_%E2%80%93_View\"><\/span>Service Call &#8211; View<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>From the assigned bots for any given data table\/table view, you can query and manipulate the data using the Service Node in the Dialog Tasks.<\/p>\n<p><strong>Steps to configure the Service node:<\/strong><\/p>\n<ol>\n<li>Open the Bot and the Dialog Task where you want to access the data.<\/li>\n<li>Add a Service Node at the appropriate location in the process flow.<\/li>\n<li><a href=\"\/docs\/bots\/bot-builder-tool\/dialog-task\/working-with-the-service-node\/\" target=\"_blank\" rel=\"noopener noreferrer\">Click here<\/a> for details on Service Node. Here we will be listing the configurations for Data Table integration.<\/li>\n<li>Component Properties configuration\n<ul>\n<li><strong>General Settings<\/strong> section\n<ul>\n<li><strong>Name<\/strong> &#8211; enter a name for the node;<\/li>\n<li><strong>Display Name<\/strong> &#8211; enter a display name for the node;<\/li>\n<li><strong>Service Type<\/strong> &#8211; choose <em>Data Service<\/em>;<\/li>\n<li><strong>Type<\/strong> &#8211; select <em>View<\/em>.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Request Definition<\/strong> &#8211; define the service request by clicking the <em>Define Request<\/em> link.<\/li>\n<li>In the slide-out page configure the following:\n<ul>\n<li><strong>Choose a Table View<\/strong> &#8211; You can choose from the list, these are the table views assigned to this bot.<\/li>\n<li>Filter the results &#8211; you can further define <em>filter criteria<\/em> using\n<ul>\n<li>the column names,<\/li>\n<li>an operator and<\/li>\n<li>filter value &#8211; these values can be static or a reference to a context object\u00a0 for example <code>{{context.entities.&lt;entity-name&gt;}}<\/code>.<\/li>\n<\/ul>\n<\/li>\n<li>Multiple filter criteria can be defined using AND\/OR connectors.<\/li>\n<li>In the absence of filter criteria, all rows are fetched limited by the limit and offset values mentioned below.<\/li>\n<\/ul>\n<\/li>\n<li>You can set a limit on the number of records fetched and<\/li>\n<li>You can choose to skip a few records from the result data set by specifying the offset value.<\/li>\n<li>You can <strong>Test<\/strong> the service request. Remember testing with context reference will fail as they will be evaluated at run time and the data will not be available till then.<\/li>\n<li><strong>Save<\/strong> the service request definition<\/li>\n<\/ul>\n<\/li>\n<li>You can set the Instance and Connections properties as per your bot requirements.<\/li>\n<li>The data returned from the data table can be accessed from the context object and used in your task as per your need,\u00a0using: <code>{{context.&lt;service_node_name&gt;.response.body.queryResult[&lt;index&gt;].&lt;column_name&gt;}}<\/code><\/li>\n<li>The response from this service call would be:\n<pre>  \"CustomerView\": {\r\n    \"response\": {\r\n      \"body\": {\r\n        \"hasMore\": true,\r\n        \"total\": 4,\r\n        \"metaInfo\": [\r\n          {\r\n            \"name\": \"type\",\r\n            \"type\": \"string\"\r\n          },\r\n          {\r\n            \"name\": \"address\",\r\n            \"type\": \"string\"\r\n          }\r\n        ],\r\n        \"queryResult\": [\r\n          {\r\n            \"type\": \"Gold\",\r\n            \"address\": \"New York\"\r\n          },\r\n          {\r\n            \"type\": \"Gold\",\r\n            \"address\": \"Chicago\"\r\n          },\r\n          {\r\n            \"type\": \"Gold\",\r\n            \"address\": \"Chicago\"\r\n          }\r\n        ]\r\n      }\r\n    }\r\n  }<\/pre>\n<\/li>\n<\/ol>\n<\/div><\/div><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 class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"Kore.ai&#8217;s Data offering lets you define Data Tables, Table Views, and manipulate them from your Virtual Assistant. This section deals with the manipulation aspect using the Service Node within a Dialog Task of your Virtual Assistant. For details on the data definition, refer here. Service Call &#8211; Table From the assigned bots for any given...","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29307"}],"collection":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/comments?post=29307"}],"version-history":[{"count":3,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29307\/revisions"}],"predecessor-version":[{"id":29311,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29307\/revisions\/29311"}],"wp:attachment":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/media?parent=29307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/categories?post=29307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/tags?post=29307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}