{"id":32092,"date":"2022-01-25T14:29:21","date_gmt":"2022-01-25T14:29:21","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?p=32092"},"modified":"2023-03-10T15:13:38","modified_gmt":"2023-03-10T15:13:38","slug":"proactive-notifications-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/proactive-notifications-api\/","title":{"rendered":"Proactive Notifications API"},"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>Proactive Notifications allow enterprises to engage with their end users (customers or employees) by providing relevant and timely updates.<\/p>\n<p>Proactive notification includes:<\/p>\n<ul>\n<li>Nudge the employees to reset their password before it expires in certain days<\/li>\n<li>Remind users to submit expense reports.<\/li>\n<li>Inform customers about their order status. <\/li>\n<li>Other reminders which are defined.<\/li>\n<\/ul>\n<table>\n<tbody>\n<tr>\n<td><b>Method<\/b><\/td>\n<td>POST<\/td>\n<\/tr>\n<tr>\n<td><b>Endpoint<\/b><\/td>\n<td>\n<p><span style=\"font-weight: 400\"><code>https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/notify<\/code><\/p>\n<p><\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Content Type<\/b><\/td>\n<td><code>application\/json<\/code><\/td>\n<\/tr>\n<tr>\n<td><b>Authorization<\/b><\/td>\n<td>\n<p><code>auth: {{JWT}}<\/code><\/p>\n<p>See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/apis\/#Generating_the_JWT_Token\" rel=\"noopener noreferrer\" target=\"_blank\">How to generate the JWT Token<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><b>API Scope<\/b><\/td>\n<td>\n<ul>\n<li>Bot Builder: Proactive Messages<\/li>\n<li>Admin Console: Channel Management > Proactive Messages<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Path_Parameters\">Path Parameters<\/span><\/h2>\n<table>\n<tbody>\n<tr>\n<th><b>Parameter<\/b><\/th>\n<th><b>Description<\/b><\/th>\n<th><b>Mandate<\/b><\/th>\n<\/tr>\n<tr>\n<td><b>host<\/b><\/td>\n<td>The environment URL. For example, <code>https:\/\/bots.kore.ai<\/code><\/td>\n<td>Required<\/td>\n<\/tr>\n<tr>\n<td><b>BotId<\/b><\/td>\n<td>\n<p><i>Bot ID<\/i> or <i>Stream ID<\/i> can be accessed under <b>General Settings<\/b> on the Bot Builder.<\/p>\n<p><b>Note<\/b>: This is required only for Bot Builder API scope of Proactive Messages.<\/td>\n<td>Required<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h2>\n<pre>curl --location --request \r\nPOST \\' https:\/\/{{host}}\/api\/public\/bot\/{{BotID}}\/notify' \\\r\n--header 'auth: {{JWT}}' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data-raw '{\r\n    \"channel\": \"msteams\",\r\n    \"userIdentityType\": \"resolve\",\r\n    \"message\": {\r\n        \"type\": \"text\",\r\n        \"val\": \"hello\"\r\n    },\r\n    \"identities\": [\r\n        \"john@kore.com\",\r\n        \"jane@outlook.com\",\r\n        \"sam@slack.com\"\r\n    ]\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<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h2>\n<table>\n<tbody>\n<tr>\n<th><b>Parameter<\/b><\/th>\n<th><b>Description<\/b><\/th>\n<th><b>Mandate<\/b><\/th>\n<\/tr>\n<tr>\n<td>channel<\/td>\n<td>\n<p>Name of the channel for which notifications to be sent<\/p>\n<p>Accepted channel types are:\u201c<strong>msteams<\/strong>\u201d and &#8220;<strong>slack<\/strong>&#8220;.<\/td>\n<td>Required<\/td>\n<\/tr>\n<tr>\n<td>userIdentityType<\/td>\n<td>\n<p>Define whether to resolve the user identities provided in the API call to get the channel identities, or to directly use the user identities for delivering the messages<\/p>\n<p>The values is <em>resolve<\/em>.<\/td>\n<td>Required<\/td>\n<\/tr>\n<tr>\n<td>message<\/td>\n<td>\n<p>It is an object and accepts two fields<\/p>\n<ul>\n<li><em>type<\/em> \u2192 Indicates the type of message. \u201ctext\u201d for sending plain text and \u201cscript\u201d for sending JavaScript templates as messages.<\/li>\n<li><em>val<\/em> \u2192 value of the message to be sent to user.<\/li>\n<\/ul>\n<p><strong>Example 1:Text<\/strong>:<br \/>\n<code>{<br \/>\n\"type\": \"text\",<br \/>\n\"val\": \"Hi User\"<br \/>\n}<\/code><\/p>\n<p><strong>Example 2: Script<\/strong>:<\/p>\n<p><code>{<br \/>\n\"type\": \"script\",<br \/>\n\"val\": \"var envMsg = 'John'; var channel = context.session.BotUserSession.lastMessage.channel; print(JSON.stringify({text: 'Hi ' + envMsg + ' message is from ' + channel + ' channel'}));\"<br \/>\n}<\/code><\/td>\n<td>Required<\/td>\n<\/tr>\n<tr>\n<td>identities<\/td>\n<td>\n<p>It accepts the list of user identities for whom notifications need to be sent.<\/p>\n<p>A maximum of 1000 identities are supported.<\/td>\n<td>Required<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h2>\n<pre>{\r\n    \"status\": \"IN_PROGRESS\",\r\n    \"percentageComplete\": 0,\r\n    \"streamId\": \"st-xxxxx-xxx-xxx-xxx-xxxxx\",\r\n    \"createdBy\": \"u-xxxxx-xxx-xxx-xxx-xxxxx\",\r\n    \"jobType\": \"PROACTIVE_NOTIFICATIONS_API\",\r\n    \"action\": \"PROACTIVE_NOTIFICATIONS\",\r\n    \"statusLogs\": [],\r\n    \"_id\": \"ds-xxxxx-xxx-xxx-xxx-xxxxx\",\r\n    \"lMod\": \"2022-01-25T06:56:48.000Z\",\r\n    \"createdOn\": \"2022-01-25T06:56:48.891Z\",\r\n    \"requestedTime\": \"2022-01-25T06:56:48.891Z\",\r\n    \"__v\": 0\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><\/div><\/div><\/div><\/div><\/div><\/section><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\r\n\t\t<\/div>\r\n\t<\/div>\r\n<\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"Proactive Notifications allow enterprises to engage with their end users (customers or employees) by providing relevant and timely updates. Proactive notification includes: Nudge the employees to reset their password before it expires in certain days Remind users to submit expense reports. Inform customers about their order status. Other reminders which are defined. Method POST Endpoint...","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-32092","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/32092","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\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=32092"}],"version-history":[{"count":7,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/32092\/revisions"}],"predecessor-version":[{"id":55805,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/32092\/revisions\/55805"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=32092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=32092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=32092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}