{"id":48048,"date":"2022-10-04T18:08:39","date_gmt":"2022-10-04T17:08:39","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=48048"},"modified":"2022-10-04T19:20:47","modified_gmt":"2022-10-04T18:20:47","slug":"travel-va-use-content-variables","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/how-tos\/travel-planing-assistant\/travel-va-use-content-variables\/","title":{"rendered":"Travel VA: Use Content Variables"},"content":{"rendered":"<p><span style=\"font-weight: 400\">The Kore.ai XO Platform allows you to declare and use variables within the assistants you build. These variables can be used to capture values that are commonly used by different tasks, nodes, and other elements<\/span><\/p>\n<p><span style=\"font-weight: 400\">In this use case, we will explore a scenario in a Travel Planning Assistant, where variables can be used, and see how Content Variables can be used to pass language-specific messages.<\/span><\/p>\n<p><span style=\"font-weight: 400\">For details on what Variables are and how they are implemented in the XO Platform, <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/bot-settings\/bot-management\/using-bot-variables\/\"><span style=\"font-weight: 400\">refer here<\/span><\/a><span style=\"font-weight: 400\">. For a use case with Global Variables, <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/how-tos\/how-to-use-global-variables\/\"><span style=\"font-weight: 400\">refer here<\/span><\/a><span style=\"font-weight: 400\">.<\/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<h1><span class=\"ez-toc-section\" id=\"Problem_Statement\"><span style=\"font-weight: 400\">Problem Statement<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">In our <\/span><span style=\"font-weight: 400\">Travel Planning Assistant<\/span><span style=\"font-weight: 400\">, we welcome users when they connect. The assistant is multilingual and we want the messages to be in the appropriate user language.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In this document, we will see how Content Variable can be used to store the message in multiple languages.<\/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<h1><span class=\"ez-toc-section\" id=\"Prerequisites\"><span style=\"font-weight: 400\">Prerequisites<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">To go through these configurations, you need to know at least the basics of <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/how-tos\/travel-planing-assistant\/create-a-travel-virtual-assistant\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400\">building a Virtual Assistant<\/span><\/a><span style=\"font-weight: 400\">.<\/span><span style=\"font-weight: 400\"> This is because your assistant needs to have been already built when you begin working on your variables.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Your Virtual Assistant will also need an <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/event-based-bot-actions\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em><span style=\"font-weight: 400\">on Connect<\/span><\/em><\/a><span style=\"font-weight: 400\"> event configured, as well as some language settings, as explained below:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>Build<\/strong><span style=\"font-weight: 400\"> tab from the top menu<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">From <\/span><strong>Intelligence<\/strong><span style=\"font-weight: 400\"> select <\/span><strong>Events<\/strong><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click the <\/span><strong>On Connect<\/strong><span style=\"font-weight: 400\"> event and configure to <\/span><strong>Show Message.<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132214\/events-config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47828\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132214\/events-config-1024x451.png\" alt=\"\" width=\"640\" height=\"282\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132214\/events-config-1024x451.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132214\/events-config-300x132.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132214\/events-config.png 1943w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/><\/strong><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Enable the Spanish language for the assistant<\/span>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">From <\/span><strong>Configurations<\/strong><span style=\"font-weight: 400\">, select <\/span><strong>Language,<\/strong><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click <\/span><strong>Add Language<\/strong><span style=\"font-weight: 400\"> and <\/span><em><span style=\"font-weight: 400\">Configure<\/span><\/em><span style=\"font-weight: 400\"> the <\/span><em><span style=\"font-weight: 400\">Spanish<\/span><\/em><span style=\"font-weight: 400\"> language.<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132223\/add-spanish.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47831\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132223\/add-spanish-1024x456.png\" alt=\"\" width=\"640\" height=\"285\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132223\/add-spanish-1024x456.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132223\/add-spanish-300x134.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132223\/add-spanish.png 1922w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/><\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\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<h1><span class=\"ez-toc-section\" id=\"Prerequisites-2\"><span style=\"font-weight: 400\">Prerequisites<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">Declaring a Content Variable to hold the On Connect message will ensure it is not missed in the language translation.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Open the Travel Planning Assistant.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>Build<\/strong><span style=\"font-weight: 400\"> tab from the top menu<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">From <\/span><strong>Configurations <\/strong><span style=\"font-weight: 400\">select the <\/span><strong>Content Variables<\/strong><span style=\"font-weight: 400\"> section.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click <\/span><strong>Add Variable<\/strong><span style=\"font-weight: 400\"> to open the corresponding window.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Enter <\/span><strong>Variable Name<\/strong><span style=\"font-weight: 400\"> and <\/span><strong>Variable Value<\/strong><span style=\"font-weight: 400\">. For this use case, we are calling the Variable <\/span><em><span style=\"font-weight: 400\">connectMessage<\/span><\/em><span style=\"font-weight: 400\">, and for the value, we are entering the \u201c<\/span><em><span style=\"font-weight: 400\">Welcome to our Travel Portal. \u201d.<\/span><\/em><\/li>\n<li style=\"font-weight: 400\"><strong>Save<\/strong><span style=\"font-weight: 400\">.<\/span><span style=\"font-weight: 400\"><br \/><\/span><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\/20221004132231\/add-var.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47835\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132231\/add-var-1024x454.png\" alt=\"\" width=\"640\" height=\"284\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132231\/add-var-1024x454.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132231\/add-var-300x133.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132231\/add-var.png 1931w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/><\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Now switch the language to <\/span><em><span style=\"font-weight: 400\">Spanish<\/span><\/em><span style=\"font-weight: 400\"> and for the same connectMessage variable using the <\/span><strong>edit<\/strong><span style=\"font-weight: 400\"> icon enter the text in Spanish \u2013 \u201c<\/span><em><span style=\"font-weight: 400\">Le damos la bienvenida al portal de viajes. <\/span><\/em><span style=\"font-weight: 400\">\u201c.<\/span><span style=\"font-weight: 400\"><br \/><\/span><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\/20221004132202\/add-var-es.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47822\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132202\/add-var-es-1024x208.png\" alt=\"\" width=\"640\" height=\"130\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132202\/add-var-es-1024x208.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132202\/add-var-es-300x61.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132202\/add-var-es.png 1921w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Return to the English version of your assistant.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Return to the On Connect Event Handler, click <\/span><strong>Add Response <\/strong><span style=\"font-weight: 400\">and replace the text with reference to the content variable using the following code:<\/span><span style=\"font-weight: 400\"><br \/><\/span><code><span style=\"font-weight: 400\">{{content.connectMessage}}<\/span><\/code><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Save<\/strong><span style=\"font-weight: 400\"> the changes.<\/span><\/li>\n<\/ol>\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<h1><span class=\"ez-toc-section\" id=\"Testing\"><span style=\"font-weight: 400\">Testing<\/span><\/span><\/h1>\n<p><span style=\"font-weight: 400\">Use <\/span><strong>Talk to Bot<\/strong><span style=\"font-weight: 400\"> to test the changes.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Open <\/span><strong>Talk to Bot<\/strong><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The message will appear in English.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Use the cheat command to switch the language:<\/span><span style=\"font-weight: 400\"><br \/><\/span><code><span style=\"font-weight: 400\">cheat lang Es<\/span><\/code><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Reconnect to the assistant and see the message in Spanish.<\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<li style=\"font-weight: 400\"><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\/20221004132207\/contentVar-test-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47825\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132207\/contentVar-test-1.png\" alt=\"\" width=\"502\" height=\"482\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132207\/contentVar-test-1.png 502w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20221004132207\/contentVar-test-1-300x288.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/a><\/span><\/li>\n<\/ol>\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>The Kore.ai XO Platform allows you to declare and use variables within the assistants you build. These variables can be used to capture values that are commonly used by different tasks, nodes, and other elements In this use case, we will explore a scenario in a Travel Planning Assistant, where variables can be used, and&#8230;<\/p>\n","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-48048","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\/48048","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=48048"}],"version-history":[{"count":3,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/48048\/revisions"}],"predecessor-version":[{"id":48087,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/48048\/revisions\/48087"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=48048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=48048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=48048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}