{"id":23535,"date":"2020-04-22T07:38:53","date_gmt":"2020-04-22T06:38:53","guid":{"rendered":"https:\/\/developer.kore.ai\/v7-2\/?p=23535"},"modified":"2020-04-22T09:44:25","modified_gmt":"2020-04-22T08:44:25","slug":"how-to-use-content-variables","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v7-2\/docs\/bots\/how-tos\/how-to-use-content-variables\/","title":{"rendered":"How to use Content Variables"},"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 a way to declare and use variables within the bot. These variables can be used to capture values that are commonly used by different tasks, nodes, and other bot elements<\/p>\n<p>In this How-To, we will explore a scenario in a Banking Bot, where Bot Variables can be used. We will see how Content Variables can be used to pass language-specific messages.<\/p>\n<p>For details on what Bot Variables are and how they are implemented in the Kore.ai Bots platform, <a href=\"\/v7-2\/docs\/bots\/bot-admin\/bots-management\/using-bot-variables\/\" target=\"_blank\" rel=\"noopener noreferrer\">refer here<\/a>. For a use case with Global Variables, <a href=\"\/v7-2\/docs\/bots\/how-tos\/how-to-use-content-variables\/\" target=\"_blank\" rel=\"noopener noreferrer\">refer here<\/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=\"Problem_Statement\">Problem Statement<\/span><\/h2>\n<p>In our <a href=\"\/v7-2\/docs\/bots\/how-tos\/creating-a-banking-bot\/\">Banking Bot<\/a>, we welcome users when they connect to the Bot. The bot is multilingual and we want the messages to be in the appropriate user language.<\/p>\n<p>In this document, we will see how Content Variable can be used to store the message in multiple languages.<\/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=\"Pre-requisites\">Pre-requisites<\/span><\/h2>\n<ul>\n<li>Bot building knowledge<\/li>\n<li>A Banking Bot with the on Connect event configured as below:\n<ul>\n<li>From\u00a0<strong>Natural Language<\/strong> -&gt;\u00a0<strong>Default Conversation<\/strong> select\u00a0<strong>Event Handlers<\/strong>.<\/li>\n<li>Click on\u00a0<strong>On Connect<\/strong> event and configure to\u00a0<strong>Show Message<\/strong><\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/13\/contentVar_onconnectevent.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23540\" src=\"\/wp-content\/uploads\/sites\/13\/contentVar_onconnectevent.png\" alt=\"\" width=\"1363\" height=\"379\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095001\/contentVar_onconnectevent.png 1363w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095001\/contentVar_onconnectevent-300x83.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095001\/contentVar_onconnectevent-1024x285.png 1024w\" sizes=\"auto, (max-width: 1363px) 100vw, 1363px\" \/><\/a><\/li>\n<li>Enable the Spanish language for the bot\n<ul>\n<li>From\u00a0<strong>Settings\u00a0<\/strong>-&gt;\u00a0<strong> Config Settings<\/strong>, select\u00a0<strong>Language Management<\/strong> and enable the <em>Spanish<\/em> language.<\/li>\n<\/ul>\n<\/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=\"Implementation\">Implementation<\/span><\/h2>\n<p>Declaring a Content Variable to hold the On Connect message will ensure it is not missed in the language translation.<\/p>\n<ol>\n<li>Open the Banking Bot.<\/li>\n<li>From\u00a0<strong>Settings -&gt; Config Settings<\/strong> select\u00a0<strong>Content Variables<\/strong> section.<\/li>\n<li>Click\u00a0<strong>Add Content Variable<\/strong> to open the corresponding window.<\/li>\n<li>Enter\u00a0<strong>Variable Name<\/strong>\u00a0and <strong>Variable Value<\/strong>. For this use case were are calling the Variable\u00a0<em>connectMessage<\/em>, and for the value, we are entering the &#8220;<em>Welcome to the Banking Portal &#8211; your one stop for all banking needs&#8221;.<\/em><\/li>\n<li><strong>Save<\/strong>.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/13\/contentVar-create.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23541\" src=\"\/wp-content\/uploads\/sites\/13\/contentVar-create.png\" alt=\"\" width=\"1361\" height=\"559\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-create.png 1361w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-create-300x123.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-create-1024x421.png 1024w\" sizes=\"auto, (max-width: 1361px) 100vw, 1361px\" \/><\/a><\/li>\n<li>Now switch the language to <em>Spanish<\/em> and for the same connectMessage variable using the <strong>edit<\/strong> icon enter the text in Spanish &#8211; &#8220;<em>Bienvenido al portal bancario: su \u00fanica parada para todas las necesidades bancarias<\/em>&#8220;.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/13\/contentVar-edit.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23542\" src=\"\/wp-content\/uploads\/sites\/13\/contentVar-edit.png\" alt=\"\" width=\"1011\" height=\"295\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-edit.png 1011w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-edit-300x88.png 300w\" sizes=\"auto, (max-width: 1011px) 100vw, 1011px\" \/><\/a><\/li>\n<li>Return to the On Connect Event Handler and replace the text with reference to the content variable using the following code:<br \/>\n<code>{{content.connectMessage}}<\/code><br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/13\/contentVar_onconnectevent2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23545\" src=\"\/wp-content\/uploads\/sites\/13\/contentVar_onconnectevent2.png\" alt=\"\" width=\"1365\" height=\"321\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201094959\/contentVar_onconnectevent2.png 1365w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201094959\/contentVar_onconnectevent2-300x71.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201094959\/contentVar_onconnectevent2-1024x241.png 1024w\" sizes=\"auto, (max-width: 1365px) 100vw, 1365px\" \/><\/a><\/li>\n<li><strong>Save<\/strong> the changes.<\/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=\"Testing\">Testing<\/span><\/h2>\n<p>Use <strong>Talk to Bot<\/strong> to test the changes.<\/p>\n<ol>\n<li>Open\u00a0<strong>Talk to Bot<\/strong>.<\/li>\n<li>The message will appear in English.<\/li>\n<li>Use the cheat command to switch the language:<br \/>\n<code>cheat lang Es<\/code>.<\/li>\n<li>Reconnect to the bot and see the message in Spanish.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/13\/contentVar-test.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-23544\" src=\"\/wp-content\/uploads\/sites\/13\/contentVar-test.png\" alt=\"\" width=\"500\" height=\"469\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-test.png 500w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/wp-content\/uploads\/sites\/13\/20221201095000\/contentVar-test-300x281.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/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 a way to declare and use variables within the bot. These variables can be used to capture values that are commonly used by different tasks, nodes, and other bot elements In this How-To, we will explore a scenario in a Banking Bot, where Bot Variables can be used. We will see...","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[],"class_list":["post-23535","post","type-post","status-publish","format-standard","hentry","category-how-tos"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/posts\/23535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/comments?post=23535"}],"version-history":[{"count":3,"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/posts\/23535\/revisions"}],"predecessor-version":[{"id":23546,"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/posts\/23535\/revisions\/23546"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/media?parent=23535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/categories?post=23535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v7-2\/wp-json\/wp\/v2\/tags?post=23535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}