{"id":47758,"date":"2022-10-04T12:10:44","date_gmt":"2022-10-04T11:10:44","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-2\/?p=47758"},"modified":"2022-10-04T19:05:20","modified_gmt":"2022-10-04T18:05:20","slug":"schedule-a-smart-alert","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-2\/docs\/bots\/how-tos\/travel-planing-assistant\/schedule-a-smart-alert\/","title":{"rendered":"Travel VA: Schedule a Smart Alert"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In this How-To, we will explore a scenario in a Virtual Assistant, say a Travel Planning Assistant, where the user needs to be provided with weather updates daily for a preferred location. We will be using an Alert task to achieve this. We will also see how auto subscription can be enabled on this Alert task, making it smart.<\/span><\/p>\n<p><span style=\"font-weight: 400\">For details on what an Alert task is and how it is implemented in the Kore.ai XO Platform, <\/span><a href=\"https:\/\/developer.kore.ai\/v10-2\/docs\/bots\/bot-builder-tool\/alert\/notification-tasks\/\"><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\">A registered user of a Virtual Assistant needs to be sent a weather update in the form of an alert, at a pre-specified time of the day and\/or at a specified interval of time.<\/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-2\/wp-content\/uploads\/sites\/45\/20221004115606\/SA-chat-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-47771\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115606\/SA-chat-1.png\" alt=\"\" width=\"496\" height=\"365\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115606\/SA-chat-1.png 496w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115606\/SA-chat-1-300x221.png 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/a><\/span><\/p>\n<p><span style=\"font-weight: 400\">In this document, we will show you how an Alert Task can be used to cater to such situations and take appropriate action.<\/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<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A working assistant, we are using a <\/span><a href=\"https:\/\/developer.kore.ai\/v10-2\/docs\/bots\/how-tos\/travel-planing-assistant\/create-a-travel-virtual-assistant\/\" target=\"_blank\" rel=\"noopener noreferrer\"><span style=\"font-weight: 400\">Travel Planning Assistant<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Access to a web service that provides weather updates. We are using a REST service hosted at: <\/span><a href=\"http:\/\/api.openweathermap.org\/\"><span style=\"font-weight: 400\">http:\/\/api.openweathermap.org<\/span><\/a><span style=\"font-weight: 400\">. If you want to use this service, you need to register to their free alert service as we will be using the API key to access their APIs.<\/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<h1><span class=\"ez-toc-section\" id=\"Implementation\"><span style=\"font-weight: 400\">Implementation<\/span><\/span><\/h1>\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=\"Set_Up_an_Alert_Task\"><span style=\"font-weight: 400\">Set Up an Alert Task<\/span><\/span><\/h2>\n<p><span style=\"font-weight: 400\">Alert tasks can be used to deliver timely, relevant, and personalized information from enterprise systems to customers and employees by polling the relevant service in real-time or according to a user-defined schedule.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">From <\/span><strong>Build &gt; Conversational Skills <\/strong><span style=\"font-weight: 400\">add an <\/span><strong>Alert Task.<\/strong><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">On the task details page:<\/span>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Enter a <\/span><strong>Task Name<\/strong><span style=\"font-weight: 400\">, say <\/span><em><span style=\"font-weight: 400\">Get Daily Weather<\/span><\/em><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Choose the <\/span><strong>Connection Type, <\/strong><span style=\"font-weight: 400\">we will go with <\/span><em><span style=\"font-weight: 400\">Webservice<\/span><\/em><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Choose the <\/span><strong>Connection Mode<\/strong><span style=\"font-weight: 400\">, we will be using <\/span><em><span style=\"font-weight: 400\">REST<\/span><\/em><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Click <\/span><strong>Create &amp; Proceed.<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115543\/add-alert.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-47759\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115543\/add-alert-1024x456.png\" alt=\"\" width=\"640\" height=\"285\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115543\/add-alert-1024x456.png 1024w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115543\/add-alert-300x134.png 300w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115543\/add-alert.png 1922w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/><\/strong><\/li>\n<li style=\"font-weight: 400\">You will be directed to the Alert Settings page\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Review and modify the <\/span><strong>General Settings<\/strong><span style=\"font-weight: 400\"> if needed. For our use case, we do not need to modify any settings here.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Configure_the_API_Request\"><span style=\"font-weight: 400\">Configure the API Request<\/span><\/span><\/h3>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Select the <\/span><strong>API Request<\/strong><span style=\"font-weight: 400\"> tab<\/span>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Ensure that the <\/span><strong>Content Type<\/strong><span style=\"font-weight: 400\"> is set to <\/span><em><span style=\"font-weight: 400\">JSON<\/span><\/em><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">We do not need to set the <\/span><strong>Authorization Provider<\/strong><span style=\"font-weight: 400\"> for our use case. Configure it if the API you are using has any authorization requirements.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Set <\/span><strong>Parameter<\/strong><span style=\"font-weight: 400\"> to gather the <\/span><em><span style=\"font-weight: 400\">preferred City<\/span><\/em><span style=\"font-weight: 400\"> from the User. Ensure that it is set as a <\/span><strong>Mandatory<\/strong><span style=\"font-weight: 400\"> field. This is the API requirement.<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115637\/task-parameters.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-47786\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115637\/task-parameters.png\" alt=\"\" width=\"438\" height=\"628\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115637\/task-parameters.png 699w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115637\/task-parameters-209x300.png 209w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/a><\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">We will not need any <\/span><strong>Initializer<\/strong><span style=\"font-weight: 400\"> requirements for our use case. Use this in case any JavaScript needs to be executed before the request is sent.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Under <\/span><strong>Request<\/strong><span style=\"font-weight: 400\"> click <\/span><strong>Add API<\/strong><span style=\"font-weight: 400\"> to add the service API that needs to be invoked. We are using a <\/span><em><span style=\"font-weight: 400\">GET<\/span><\/em><span style=\"font-weight: 400\"> method from the following API: <\/span><code><span style=\"font-weight: 400\">http:\/\/api.openweathermap.org\/data\/2.5\/weather?q={cityname}&amp;APPID=&lt;your-app-id&gt;<\/span><\/code>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The <\/span><strong>APPID<\/strong><span style=\"font-weight: 400\"> in the above url is assigned to you by OpenWeather when you sign up. You can find it from the <\/span><a href=\"https:\/\/home.openweathermap.org\/api_keys\"><span style=\"font-weight: 400\">API keys<\/span><\/a><span style=\"font-weight: 400\"> section after you login to your account.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Notice that the <\/span><strong>Parameters<\/strong><span style=\"font-weight: 400\"> list is populated automatically with the parameters entered earlier.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Save <\/strong><span style=\"font-weight: 400\">the API.<br \/><a ref=\"magnificPopup\" href=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115550\/add-api-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-47762\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115550\/add-api-1.png\" alt=\"\" width=\"515\" height=\"562\" srcset=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115550\/add-api-1.png 697w, https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-2\/wp-content\/uploads\/sites\/45\/20221004115550\/add-api-1-275x300.png 275w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/span><span style=\"font-weight: 400\"><br \/><\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Test<\/strong><span style=\"font-weight: 400\"> the API to ensure that the configuration is proper. Enter a sample city name, when prompted and ensure you get a success message and a proper Response.<\/span><\/li>\n<li style=\"font-weight: 400\"><strong>Save<\/strong><span style=\"font-weight: 400\"> your settings.<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this How-To, we will explore a scenario in a Virtual Assistant, say a Travel Planning Assistant, where the user needs to be provided with weather updates daily for a preferred location. We will be using an Alert task to achieve this. We will also see how auto subscription can be enabled on this Alert&#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-47758","post","type-post","status-publish","format-standard","hentry","category-travel-planing-assistant"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/posts\/47758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/comments?post=47758"}],"version-history":[{"count":5,"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/posts\/47758\/revisions"}],"predecessor-version":[{"id":48078,"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/posts\/47758\/revisions\/48078"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/media?parent=47758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/categories?post=47758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-2\/wp-json\/wp\/v2\/tags?post=47758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}