{"id":41293,"date":"2022-04-21T09:33:56","date_gmt":"2022-04-21T08:33:56","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=41293"},"modified":"2022-04-21T09:34:16","modified_gmt":"2022-04-21T08:34:16","slug":"sdk-events","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/sdks\/sdk-events\/?lang=ko","title":{"rendered":"BotKit SDK\uc6a9 \uc774\ubca4\ud2b8"},"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 BotKit SDK\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubd07 \ud50c\ub7ab\ud3fc\uc5d0\uc11c \uc774\ubca4\ud2b8\ub97c \ucea1\ucc98\ud558\uace0 \ucc98\ub9ac\ud558\uc5ec \uc0ac\uc6a9\uc790\uc758 \ubd07 \uacbd\ud5d8\uc744 \ub354 \uc798 \ud1b5\uc81c\ud558\uace0 \uc0ac\uc6a9\uc790 \uc815\uc758\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. BotKit SDK\ub294 \ub2e4\uc74c \uc774\ubca4\ud2b8\ub97c \uc9c0\uc6d0\ud569\ub2c8\ub2e4.<\/p>\n<ul>\n<li><a href=\"#message\">onMessage<\/a><\/li>\n<li><a href=\"#web\">onWebhook<\/a><\/li>\n<li><a href=\"#agent\">onAgentTransfer<\/a><\/li>\n<li><a href=\"#onevent\">onEventNode<\/a><\/li>\n<li><a href=\"#onalert\">onAlertNode<\/a><\/li>\n<li><a href=\"#onvariable\">onVariableUpdate<\/a><\/li>\n<li><a href=\"#OnClientEvent\">onClientEvent<\/a><\/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 id=\"message\"><span class=\"ez-toc-section\" id=\"onMessage\">onMessage<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 \ub2e4\uc74c \ub450 \uac00\uc9c0 \uad6c\uc131 \uc694\uc18c\ub85c \uad6c\uc131\ub429\ub2c8\ub2e4.<\/p>\n<ul>\n<li><span style=\"text-decoration: underline;\">onUserMessage:<\/span> \ubcf8 \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\uac00 \ubd07\uc5d0 \uba54\uc2dc\uc9c0\ub97c \ubcf4\ub0b4\uace0 \ucc44\ub110 \uc5b4\ub311\ud130\uac00 \uc774\ub97c \uc218\uc2e0\ud560 \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0\ub294 \ubcf8 \uc774\ubca4\ud2b8\uc5d0\uc11c \ub798\ud551 \ub418\uc5b4 SDK\ub85c \uc804\uc1a1\ub429\ub2c8\ub2e4.<\/li>\n<li><span style=\"text-decoration: underline;\">onBotMessage<\/span>: \ubcf8 \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\uc5d0\uac8c \uba54\uc2dc\uc9c0\ub97c \ubcf4\ub0b4\uc57c \ud560 \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uc774\ub7ec\ud55c \uba54\uc2dc\uc9c0\ub294 <code>context<\/code> \uac1c\uccb4\uc640 \ud568\uaed8 SDK\ub85c \uc804\uc1a1\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\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 id=\"bot\"><span class=\"ez-toc-section\" id=\"onUserMessage\"><strong>onUserMessage<\/strong><\/span><\/h3>\n<p>\uad6c\ubb38:<\/p>\n<pre class=\"lang:default decode:true\">on_user_message : function(requestId, data, callback)<\/pre>\n<p>\ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> &#8211; \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>payload<\/code> &#8211; \ub2e4\uc74c\uacfc \uac19\uc740 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc.\n<pre class=\"lang:default decode:true\">{\r\n   \"message\":\"message sent by bot to the user\",\r\n   \"taskId\":\"Dialog task Id\",\r\n   \"nodeId\":\"current node id in the dialog flow\",\r\n   \"channel\":\"channel name\",\r\n   \"context\":\"context object\"\r\n}<\/pre>\n<\/li>\n<li><code>callback<\/code> &#8211; \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub418\ub294 \uc774\ubca4\ud2b8 \uc644\ub8cc \uc2dc \ud638\ucd9c\ud558\ub294 \ud568\uc218.<\/li>\n<\/ul>\n<p>\uc608: onUserMessage \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \ub2e4\uc74c \ucf54\ub4dc \uc608\uc5d0\uc11c, \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0\ub294 \ub77c\uc774\ube0c \uc0c1\ub2f4\uc0ac\ub85c \uc804\ud658\uc744 \uc704\ud574 \ud3c9\uac00\ub41c \ud6c4 \uc804\ud658\ub418\uace0, \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \uba54\uc2dc\uc9c0\ub294 \ucc98\ub9ac\ub97c \uc704\ud574 BotKit SDK\ub85c \uc804\ub2ec\ub429\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:default decode:true\">\/*\r\n * OnUserMessage event handler\r\n *\/\r\nfunction onUserMessage(requestId, payload, callback){\r\n    debug(\"user message\", payload);\r\n    var visitorId = _.get(payload, 'channel.from');\r\n\tvisitorId = payload.context.session.UserContext._id;\r\n\tvar entry = _map[visitorId];\r\n\tif (payload.message === \"clearagent\") \/\/ disconnect from LiveChat on user utterance\r\n\t{\r\n\t\tsdk.clearAgentSession(payload);\r\n\t}\r\n    if(entry){\/\/check for live agent\r\n        \/\/route to live agent\r\n        var formdata = {};\r\n        formdata.secured_session_id = entry.secured_session_id;\r\n        formdata.licence_id = config.liveagentlicense;\r\n        formdata.message = payload.message;\r\n        return api.sendMsg(visitorId, formdata)\r\n            .catch(function(e){\r\n                console.error(e);\r\n                delete userDataMap[visitorId];\r\n                delete _map[visitorId];\r\n                return sdk.sendBotMessage(payload, callback);\r\n            });\r\n    }\r\n    else {\r\n        return sdk.sendBotMessage(payload, callback);\r\n    }\r\n}<\/pre>\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=\"onBotMessage\"><strong>onBotMessage<\/strong><\/span><\/h3>\n<p>\uad6c\ubb38:<\/p>\n<pre class=\"lang:default decode:true\">\u00a0on_bot_message : function(requestId, data, callback)<\/pre>\n<p>\ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> &#8211; \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>payload<\/code> &#8211; \ub2e4\uc74c\uacfc \uac19\uc740 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc.\n<pre class=\"lang:default decode:true\">{\r\n   \"message\":\"message sent to the user\",\r\n   \"channel\":\"channel name\",\r\n   \"context\":\"context object\"\r\n}<\/pre>\n<\/li>\n<li><code>callback<\/code> &#8211; \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \uc0ac\uc6a9\uc790\uc5d0\uac8c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub418\ub294 \uc774\ubca4\ud2b8 \uc644\ub8cc \uc2dc \ud638\ucd9c\ud558\ub294 \ud568\uc218.<\/li>\n<\/ul>\n<p>\uc608: \ub2e4\uc74c \ucf54\ub4dc \uc870\uac01 onBotMessage \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0\ub97c \ucf58\ud150\uce20\uc5d0 \ub300\ud574 \ud3c9\uac00\ud55c \ub2e4\uc74c \uba54\uc2dc\uc9c0 \ud1a4\uc5d0 \ub300\ud574 \ud3c9\uac00\ud569\ub2c8\ub2e4. \uba54\uc2dc\uc9c0 \ud1a4\uc774 \ud654\ub09c \ud1a4\uc5d0 \ub300\ud574 2\uc774\uc0c1\uc778 \uacbd\uc6b0, \uc0ac\uc6a9\uc790\uc640 \ubd07 \uac04\uc758 \ubd07 \ud1b5\uc2e0\uc740 \ub77c\uc774\ube0c \uc0c1\ub2f4\uc0ac\ub85c \uc804\ud658\ub429\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:default decode:true\">\/*\r\n * onBotMessage event handler\r\n *\/\r\nfunction onBotMessage(requestId, payload, callback){\r\n    debug(\"Bot Message Data\",payload);\r\n\tconsole.log(\"in bot message\");\r\n    var visitorId = _.get(paylod, 'channel.from');\r\n    var entry = _map[visitorId];\r\n    if(data.message.length === 0 || payload.message === '') {\r\n        return;\r\n    }\r\n    var message_tone = _.get(payload, 'context.message_tone');console.log(\"message tone -----\",message_tone);\r\n    if(message_tone &amp;&amp; message_tone.length&gt; 0){\r\n        var angry = _.filter(message_tone, {tone_name: 'angry'});\r\n        if(angry.length){\r\n            angry = angry[0];\r\n            if(angry.level &gt;=2){\r\n              return  connectToAgent(requestId, data);\r\n            }\r\n        }\r\n    }\r\n    if(!entry)\r\n    {\r\n        sdk.sendUserMessage(payload, callback);\r\n    }\r\n}<\/pre>\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 id=\"web\"><span class=\"ez-toc-section\" id=\"onWebHook\">onWebHook<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 Kore NL \uc5d4\uc9c4\uc774 \ub300\ud654 \ud750\ub984\uc5d0\uc11c Webhook \ub178\ub4dc\ub97c \ucc98\ub9ac\ud560 \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \ubcf8 \uc774\ubca4\ud2b8\ub294 <code>componentId<\/code> \ubc0f \ucee8\ud14d\uc2a4\ud2b8\uc640 \ud568\uaed8 SDK\ub85c \uc804\uc1a1\ub429\ub2c8\ub2e4. SDK\ub294 \ube44\uc988\ub2c8\uc2a4 \ub85c\uc9c1\uc744 \uc2e4\ud589\ud558\uace0 \uc5c5\ub370\uc774\ud2b8\ub41c \ucee8\ud14d\uc2a4\ud2b8\ub97c \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \ubcf4\ub0bc \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uad6c\ubb38:<\/p>\n<pre class=\"lang:default decode:true\">on_webhook = function(requestId, componentId, payload, callback)<\/pre>\n<p>\ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> &#8211; \uac01 webhook \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>componentId<\/code> &#8211; SDKWebhook \ub178\ub4dc\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>payload<\/code> &#8211; \ub2e4\uc74c\uacfc \uac19\uc740 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc.\n<pre class=\"lang:default decode:true\">{\r\n   \"message\":\"message sent by bot to the Bots platform\",\r\n   \"taskId\":\"Dialog task Id\",\r\n   \"nodeId\":\"current node id in the dialog flow\",\r\n   \"channel\":\"channel name\",\r\n   \"context\":\"context object\"\r\n}<\/pre>\n<\/li>\n<li><code>callback<\/code> &#8211; \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub418\ub294 \uc774\ubca4\ud2b8 \uc644\ub8cc \uc2dc \ud638\ucd9c\ud558\ub294 \ud568\uc218.<\/li>\n<\/ul>\n<p>\uc608\uc2dc <code>on_webhook<\/code> \uc774\ubca4\ud2b8\uc758 \ub2e4\uc74c \uc608\uc2dc\uc5d0\uc11c, \ub450 \ud638\ud154 \uc774\ub984\uc740 \uc0ac\uc6a9\uc790 \uc785\ub825\uc5d0 \ub300\ud55c \uc751\ub2f5\uc758 \uacb0\uacfc\ub85c \ubc18\ud658\ub429\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:default decode:true \">    \/\/on_webhook handler\r\n    on_webhook  : function(requestId, payload, componentId, callback) {\r\n        if (componentId === 'sendResponse') {\r\n          var hotels = {\r\n            \"hotels\":[\r\n                  \"Taj Banjara\",\r\n                  \"Novotel\"\r\n            ]\r\n          };\r\n          payload.context.hotelResults = hotels;\r\n          callback(null,data);\r\n        }\r\n    }<\/pre>\n<p><code>on_webhook<\/code> \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uc774 \uc608\uc2dc\uc5d0\uc11c, \ub300\ud654 \uc791\uc5c5\uc758 <em>\ud56d\uacf5\ud3b8 \uc815\ubcf4<\/em> \ub178\ub4dc\uc758 \uacbd\uc6b0, \uc694\uccad\ub41c \ub0a0\uc9dc\uc5d0 \ub530\ub978 \ucd9c\ubc1c \ub610\ub294 \ubaa9\uc801\uc9c0 \uacf5\ud56d\uc758 \ubaa9\ub85d\uc740 \ucd5c\uc885 \uc0ac\uc6a9\uc790\uc5d0\uac8c \ud45c\uc2dc\ub418\ub294 \uacb0\uacfc \ubaa9\ub85d\uc73c\ub85c\uc11c \ub300\ud654 \ud750\ub984\uc5d0 \uae30\ubc18\ud558\uc5ec \ubc18\ud658\ub429\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:default decode:true \">    on_webhook : function(requestId, payload, componentId, callback) {\r\n        var context = payload.context;\r\n\t    if (componentName === 'FlightsInfo') {\r\n\t\t  var origin = context.entities.Source;\r\n          var destination = context.entities.Dest;\r\n          var departureDate = context.entities.Date;\r\n          findFlights(origin,destination,departureDate)\r\n\t\t\t.then(function(flightResults) {\r\n                payload.context.flightResults = flightResults;\r\n\t\t\t\tcallback(null, data);\r\n\t\t\t});\r\n\t    } else if(componentId === 'GetSourceAirports'){\r\n             var searchTerm = context.entities.SourceName;\r\n             findAirports(searchTerm)\r\n            .then(function(airportResults) {\r\n                payload.context.sourceAirports = airportResults;\r\n                callback(null, data);\r\n            });\r\n        } else if(componentId === 'GetDestAirports'){\r\n           var searchTerm = context.entities.DestName;\r\n             findAirports(searchTerm)\r\n            .then(function(airportResults) {\r\n                payload.context.destAirports = airportResults;\r\n                callback(null, data);\r\n            });\r\n        }<\/pre>\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 id=\"agent\"><span class=\"ez-toc-section\" id=\"onAgentTransfer\">onAgentTransfer<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 Kore NL \uc5d4\uc9c4\uc774 \ub300\ud654 \ud750\ub984\uc5d0\uc11c \uc0c1\ub2f4\uc0ac \uc804\ud658 \ub178\ub4dc\ub97c \ucc98\ub9ac\ud560 \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \ubcf8 \uc774\ubca4\ud2b8\ub294 <code>requestId<\/code> \ubc0f \ucee8\ud14d\uc2a4\ud2b8\uc640 \ud568\uaed8 SDK\ub85c \uc804\uc1a1\ub429\ub2c8\ub2e4. SDK\ub294 \ube44\uc988\ub2c8\uc2a4 \ub85c\uc9c1\uc744 \uc2e4\ud589\ud558\uc5ec \uc0ac\uc6a9\uc790\ub97c \ub77c\uc774\ube0c \uc0c1\ub2f4\uc0ac\ub85c \uc6d0\ud65c\ud558\uac8c \uc804\ud658\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uad6c\ubb38:<\/p>\n<pre class=\"lang:default decode:true\">function onAgentTransfer(requestId, data, callback){\r\nconnectToAgent(requestId, data, callback);\r\n}<\/pre>\n<p>\ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> &#8211; \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>payload<\/code> &#8211; \ub2e4\uc74c\uacfc \uac19\uc740 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc.\n<pre class=\"lang:default decode:true\">{\r\n   OnAgentTransferPayload \",\"\r\n      requestId \":1501244156289,\"\r\n      botId \":\"st - b4a22e86 - e95b - 575 c - b888 - e106d083a251 \",\"\r\n      callbackUrl \":\"https: \/\/bots.kore.ai\/api\/botsdk\/stream\/st-b4a22e86-e95b-575c-b888-e106d083a251\/serviceCallback\/1501244156289\",\"context\": ...\r\n}<\/pre>\n<\/li>\n<li><code>callback<\/code> &#8211; \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub418\ub294 \uc774\ubca4\ud2b8 \uc644\ub8cc \uc2dc \ud638\ucd9c\ud558\ub294 \ud568\uc218.<\/li>\n<\/ul>\n<p>\uc608: \ub2e4\uc74c \ucf54\ub4dc \uc870\uac01 onAgentTransfer \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\ub97c \ub77c\uc774\ube0c \uc0c1\ub2f4\uc0ac\uc5d0 \uc5f0\uacb0\ud558\uace0 \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0, \ubd07 \uba54\uc2dc\uc9c0 \ubc0f \uc138\uc158\uc758 \uacfc\uac70 \ub300\ud654 \uba54\uc2dc\uc9c0\ub97c \uc804\ub2ec\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"lang:default decode:true\">function connectToAgent(requestId, data, cb){\r\nvar formdata = {}; console.log(\"userlog\",JSON.stringify(data.context.session.UserContext._id));\r\nformdata.licence_id = config.liveagentlicense;\r\nformdata.welcome_message = \"\";\r\nvar visitorId = _.get(data, 'channel.channelInfos.from');\r\nif(!visitorId){\r\nvisitorId = _.get(data, 'channel.from');\r\n}\r\nvisitorId = data.context.session.UserContext._id;\r\nuserDataMap[visitorId] = data;\r\ndata.message=\"An Agent will be assigned to you shortly!!!\";\r\nvar d = new Date();\r\ndata.context.session.BotUserSession.startTime = new Date().toLocaleString();\r\nconsole.log(\"userlog\",JSON.stringify(data.context.session));\r\nsdk.sendUserMessage(data, cb);\r\nformdata.welcome_message = \"Link for user Chat history with bot: \"+ config.app.url +\"\/history\/index.html?visitorId=\" + visitorId;\r\nreturn api.initChat(visitorId, formdata)\r\n.then(function(res){\r\n_map[visitorId] = {\r\nsecured_session_id: res.secured_session_id,\r\nvisitorId: visitorId,\r\nlast_message_id: 0\r\n};\r\n});\r\n}<\/pre>\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 id=\"onevent\"><span class=\"ez-toc-section\" id=\"OnEvent\">OnEvent<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 \ub300\ud654 \uc791\uc5c5 \ub610\ub294 FAQ\uac00 \ubd07\uc5d0\uc11c \uc885\ub8cc\ub418\uace0 \uc694\uccad ID \ubc0f \ucee8\ud14d\uc2a4\ud2b8\ub97c SDK\ub85c \ubcf4\ub0bc \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uad6c\ubb38: on_event : function (requestId, data, callback) \ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li>requestId \u2013 \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li>data\u2013 \uc544\ub798 \uc608\uc2dc\uc640 \uac19\uc740 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc.<\/li>\n<li>callback \u2013 \uc774\ubca4\ud2b8 \uc644\ub8cc \ud6c4 \ud638\ucd9c\ud558\ub294 \ud568\uc218\uc774\uba70, \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n<p>\uc608:<\/p>\n<pre>on_event : function (requestId, data, callback)\r\n{\r\nreturn sdk.sendAlertMessage(data, callback);\r\n}<\/pre>\n<p>\uc774\ubca4\ud2b8\ub294 kit\uc5d0 \uc804\uc1a1\ub41c \ub370\uc774\ud130 \uac1c\uccb4\uc5d0 \ub2e4\uc74c \ucf54\ub4dc\ub97c \ucd94\uac00\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"\">\"event\":\r\n{\r\n\"event Type\": \"endDialog\"\/ \u201cendFAQ\u201d\r\n}<\/pre>\n<pre><\/pre>\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 id=\"onalert\"><span class=\"ez-toc-section\" id=\"OnAlert\">OnAlert<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 \ubd07 \uc0ac\uc6a9\uc790\uac00 \uc54c\ub9bc\uc744 \uc218\uc2e0\ud560 \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uad6c\ubb38: on_alert : function (requestId, data, callback) \ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> \u2013 \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>data<\/code>\u2013 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc.<\/li>\n<li><code>callback<\/code> \u2013 \uc774\ubca4\ud2b8 \ud638\ucd9c \uc2dc \ud638\ucd9c\ud558\ub294 \ud568\uc218\uc774\uba70, \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n<p>\uc608:<\/p>\n<pre class=\"\">on_alert: function(requestId, data, callback)\r\n{\r\n return sdk.sendAlertMessage(data, callback);\r\n}<\/pre>\n<p>\uc54c\ub9bc \uc751\ub2f5 \ub370\uc774\ud130\ub294 kit\ub85c \uc804\uc1a1\ub41c \ub370\uc774\ud130 \uac1c\uccb4\uc5d0\uc11c \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/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 id=\"onvariable\"><span class=\"ez-toc-section\" id=\"OnVariableUpdate\">OnVariableUpdate<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 \ubd07\uc774 \uac8c\uc2dc\ub420 \ub54c <strong>variable_update<\/strong>\uc5d0\uc11c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uad6c\ubb38: variable_update : function (requestId, data, callback) \ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> \u2013 \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>data<\/code>\u2013 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc<\/li>\n<li><code>callback<\/code> \u2013 \uc774\ubca4\ud2b8 \ud638\ucd9c \ud6c4 \ud638\ucd9c\ud558\ub294 \ud568\uc218\uc774\uba70, \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n<pre>var event = data.eventType;\r\nconsole.log(\"event-----------&gt;\", event);\r\nif (first || event == \"variable_update\") {\r\n\/\/ fetch BotVariables List for published Bots\r\nsdk.fetchBotVariable(data, langArr, function(err, response) {\r\ndataStore.saveAllVariables(response, langArr);\r\nfirst = false;\r\n});\r\n} else {\r\nvar lang = data.language;\r\n\/\/update Existing BotVariables in Storage\r\nupdateBotVariableInDataStore(botVariables, data, event, lang);\r\n}\r\nconsole.log(dataStore);<\/pre>\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 id=\"onvariable\"><span class=\"ez-toc-section\" id=\"OnClientEvent\">OnClientEvent<\/span><\/h2>\n<p>\ubcf8 \uc774\ubca4\ud2b8\ub294 \ubd07\uc774 \ud0c0\uc0ac \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc774 \ubcf4\ub0b8 \ud074\ub77c\uc774\uc5b8\ud2b8 \uc774\ubca4\ud2b8\ub97c \uc218\uc2e0\ud560 \ub54c <strong>client_event<\/strong>\uc5d0\uc11c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uad6c\ubb38: on_client_event : function (requestId, data, callback) \ub9e4\uac1c\ubcc0\uc218:<\/p>\n<ul>\n<li><code>requestId<\/code> \u2013 \uac01 \uba54\uc2dc\uc9c0 \uc774\ubca4\ud2b8\uc5d0 \ub300\ud55c \uace0\uc720 ID.<\/li>\n<li><code>data<\/code>\u2013 JSON \uc751\ub2f5 \ud398\uc774\ub85c\ub4dc<\/li>\n<li><code>callback<\/code> \u2013 \uc774\ubca4\ud2b8 \ud638\ucd9c \ud6c4 \ud638\ucd9c\ud558\ub294 \ud568\uc218\uc774\uba70, \uc5c5\ub370\uc774\ud2b8\ub41c \uba54\uc2dc\uc9c0\uc640 \ucee8\ud14d\uc2a4\ud2b8\ub97c \ubd07 \ud50c\ub7ab\ud3fc\uc73c\ub85c \ub2e4\uc2dc \uc804\uc1a1\ud558\ub294 \ub370 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n<\/ul>\n<pre>on_client_event : function (requestId, data, callback) {\r\n    console.log(\"on_client_event --&gt;  : \", data.preDefinedEvent, data.customEvent);\r\n    return sdk.sendBotEvent(data, callback);\r\n    }<\/pre>\n<p>\uc774\ub7ec\ud55c \uc774\ubca4\ud2b8\ub294 botkit \uc774\ubca4\ud2b8 \uc720\ud615(<strong>onMessage<\/strong> \ubc0f <strong>onagenttransfer<\/strong>)\ub97c \uad6c\ub3c5\ud558\ub294 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uacfc \uc5f0\uacb0\ub429\ub2c8\ub2e4. \uc774\ub7ec\ud55c \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\uac00 \uc785\ub825 \uc911\uc774\uac70\ub098, \uc0ac\uc6a9\uc790\uac00 \uc785\ub825\uc744 \uc911\ub2e8\ud558\uac70\ub098 \uc0ac\uc6a9\uc790\uac00 \uba54\uc2dc\uc9c0\ub97c \uc77d\uc5c8\uc74c\uacfc \uac19\uc740 \uc774\ubca4\ud2b8\ub97c \ucd94\uc801\ud558\ub294 \ub370 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc608:<\/p>\n<ul>\n<li><strong>\uc0ac\uc6a9\uc790\uac00 \uc785\ub825\uc744 \uc2dc\uc791\ud568:<br \/><\/strong><em>\uc694\uccad<\/em>:<br \/>{ \u201cresourceid\u201d: \u201c\/bot.clientEvent\u201d,<br \/>\u201cpreDefinedEvent\u201d : { \u201ctype\u201d: \u201cTYPING_STARTED\u201d },<br \/>\u201ccustomEvent\u201d: {\u201ctest\u201d:\u201dtest\u201d},<br \/>\u201cbotInfo\u201d: {\u201cchatBot\u201d:\u201d&lt;bot-name&gt;\u201d,<br \/>\u201ctaskBotId\u201d:\u201d&lt;bot-id&gt;\u201d} }<br \/><em>Response1<\/em>:<br \/>{\u201cok\u201d:true,\u201dtype\u201d:\u201dack\u201d}<br \/><em>Response2<\/em>:<br \/>{\u201ctype\u201d:\u201devents\u201d,<br \/>\u201cfrom\u201d:\u201dbot\u201d,<br \/>\u201cbotInfo\u201d: {\u201cchatBot\u201d:\u201d&lt;bot-name&gt;\u201d, \u201ctaskBotId\u201d:\u201d&lt;bot-id&gt;\u201d} },<br \/>\u201cpreDefinedEvent\u201d:{\u201ctype\u201d:\u201dTYPING_STARTED\u201d},<br \/>\u201ccustomEvent\u201d:{\u201ctest\u201d:\u201dtest\u201d},\u201dtraceId\u201d:\u201d6b12f4cc73c806dd\u201d}<\/li>\n<li><strong>\uc0ac\uc6a9\uc790\uac00 \uc785\ub825\uc744 \uc911\ub2e8\ud568:<br \/><\/strong><em>\uc694\uccad<\/em>:<br \/>{ \u201cresourceid\u201d: \u201c\/bot.clientEvent\u201d,<br \/>\u201cpreDefinedEvent\u201d : { \u201ctype\u201d: \u201cTYPING_STOPPED\u201d },<br \/>\u201ccustomEvent\u201d: {\u201ctest\u201d:\u201dtest\u201d},<br \/>\u201cbotInfo\u201d: {\u201cchatBot\u201d:\u201d&lt;bot-name&gt;\u201d,<br \/>\u201ctaskBotId\u201d:\u201d&lt;bot-id&gt;\u201d} }<br \/><em>Response1<\/em>:<br \/>{\u201cok\u201d:true,\u201dtype\u201d:\u201dack\u201d}<br \/><em>Response2<\/em>:<br \/>{\u201ctype\u201d:\u201devents\u201d,<br \/>\u201cfrom\u201d:\u201dbot\u201d,<br \/>\u201cbotInfo\u201d: {\u201cchatBot\u201d:\u201d&lt;bot-name&gt;\u201d, \u201ctaskBotId\u201d:\u201d&lt;bot-id&gt;\u201d} },<br \/>\u201cpreDefinedEvent\u201d:{\u201ctype\u201d:\u201dTYPING_STOPPED\u201d},<br \/>\u201ccustomEvent\u201d:{\u201ctest\u201d:\u201dtest\u201d},\u201dtraceId\u201d:\u201d6b12f4cc73c806dd\u201d}<\/li>\n<li><strong>\uc0ac\uc6a9\uc790\uac00 \uba54\uc2dc\uc9c0\ub97c \uc77d\uc5c8\uc74c:<br \/><\/strong><em>\uc694\uccad<\/em>:<br \/>{ \u201cresourceid\u201d: \u201c\/bot.clientEvent\u201d,<br \/>\u201cpreDefinedEvent\u201d : { \u201ctype\u201d: \u201cMESSAGE_READ\u201d, \u201cid\u201d: \u201c&lt;msg-id&gt;\u201d },<br \/>\u201ccustomEvent\u201d: {\u201cstring\u201d},<br \/>\u201cbotInfo\u201d: {\u201cchatBot\u201d:\u201d&lt;bot-name&gt;\u201d,<br \/>\u201ctaskBotId\u201d:\u201d&lt;bot-id&gt;\u201d} }<br \/><em>Response1<\/em>:<br \/>{\u201cok\u201d:true,\u201dtype\u201d:\u201dack\u201d}<br \/><em>Response2<\/em>:<br \/>{\u201ctype\u201d:\u201devents\u201d,<br \/>\u201cfrom\u201d:\u201dbot\u201d,<br \/>\u201cbotInfo\u201d: {\u201cchatBot\u201d:\u201d&lt;bot-name&gt;\u201d, \u201ctaskBotId\u201d:\u201d&lt;bot-id&gt;\u201d} },<br \/>\u201cpreDefinedEvent\u201d:{\u201ctype\u201d:\u201dMESSAGE_READ\u201d, \u201cid\u201d:\u201d&lt;msg-id&gt;\u201d},<br \/>\u201ccustomEvent\u201d:{\u201cstring\u201d},\u201dtraceId\u201d:\u201d6b12f4cc73c806dd\u201d}<\/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><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"Kore.ai BotKit SDK\ub97c \uc0ac\uc6a9\ud558\uc5ec \ubd07 \ud50c\ub7ab\ud3fc\uc5d0\uc11c \uc774\ubca4\ud2b8\ub97c \ucea1\ucc98\ud558\uace0 \ucc98\ub9ac\ud558\uc5ec \uc0ac\uc6a9\uc790\uc758 \ubd07 \uacbd\ud5d8\uc744 \ub354 \uc798 \ud1b5\uc81c\ud558\uace0 \uc0ac\uc6a9\uc790 \uc815\uc758\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. BotKit SDK\ub294 \ub2e4\uc74c \uc774\ubca4\ud2b8\ub97c \uc9c0\uc6d0\ud569\ub2c8\ub2e4. onMessage onWebhook onAgentTransfer onEventNode onAlertNode onVariableUpdate onClientEvent onMessage \ubcf8 \uc774\ubca4\ud2b8\ub294 \ub2e4\uc74c \ub450 \uac00\uc9c0 \uad6c\uc131 \uc694\uc18c\ub85c \uad6c\uc131\ub429\ub2c8\ub2e4. onUserMessage: \ubcf8 \uc774\ubca4\ud2b8\ub294 \uc0ac\uc6a9\uc790\uac00 \ubd07\uc5d0 \uba54\uc2dc\uc9c0\ub97c \ubcf4\ub0b4\uace0 \ucc44\ub110 \uc5b4\ub311\ud130\uac00 \uc774\ub97c \uc218\uc2e0\ud560 \ub54c \uc2e4\ud589\ub429\ub2c8\ub2e4. \uc0ac\uc6a9\uc790 \uba54\uc2dc\uc9c0\ub294...","protected":false},"author":22,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-41293","post","type-post","status-publish","format-standard","hentry","category-sdks"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/41293","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\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=41293"}],"version-history":[{"count":1,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/41293\/revisions"}],"predecessor-version":[{"id":41294,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/41293\/revisions\/41294"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=41293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=41293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=41293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}