{"id":18046,"date":"2018-05-04T07:47:19","date_gmt":"2018-05-04T07:47:19","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?post_type=docs&#038;p=13873"},"modified":"2024-03-05T11:38:43","modified_gmt":"2024-03-05T11:38:43","slug":"adding-webhook-channel","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/channel-enablement\/adding-webhook-channel\/","title":{"rendered":"Adding WebHook as a channel"},"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>Webhook channel provides a generic integration framework to connect your virtual assistant with any external communication systems. Kore.ai XO Platform provides standard request and response APIs to send and receive messages in text format. The end user\u2019s input through a voice, keypad, or any other means must be converted to plain text before <span style=\"font-weight: 400;\">sending <\/span> to the Kore.ai XO Platform using the Request API.<\/p>\n<p>The Webhook Channel will continue to be available under the \u2018Available Channels\u2019 list, and you can choose to create additional instances. Each Webhook channel instances is presented as an independent channel to define messages, prompts, filters, etc., across the application.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Webhook_Versions\">Webhook Versions<\/span><\/h2>\n<p>The platform supports two versions of the Webhook channel i.e., V1.0 and V2.0.<\/p>\n<p><b>Note<\/b>: V2.0 is the recommended version as it provides a scalable request and response format.<\/p>\n<p>Here are the key differences:<\/p>\n<table>\n<thead>\n<tr>\n<th><b>Feature<\/b><\/th>\n<th><b>Webhook V1.0<br \/>\n<\/b><\/th>\n<th><b>Webhook V2.0<br \/>\n<\/b><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">Events<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Not supported<\/span><\/td>\n<td>Supports \u2018on connect\u2019 event<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Poll Mechanism<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Not supported<\/span><\/td>\n<td>Supported in Synchronous Mode<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">File Upload in Chunks<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Not supported<\/span><\/td>\n<td>Supported<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span class=\"ez-toc-section\" id=\"Integration_Mode\">Integration Mode<\/span><\/h2>\n<p>The platform supports Synchronous and Asynchronous modes of integrations for the Webhook channel. Here are the key differences:<\/p>\n<ul>\n<li><strong>Synchronous Mode<\/strong>: The bot responses are directly delivered as a response to the incoming requests. The bot will execute the flow, identify the response or responses to be delivered, and provide them as the response to the incoming request. Some platform functionalities like Alert Tasks, Agent Transfer, and Proactive Session Closure messages are not supported in the Synchronous mode. You may consider using the onAlert event through BotKit, <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/sdks\/sdk-events\/#OnAlert\">Learn more<\/a>.<br \/>\n<strong>Note<\/strong>: Synchronous Webhook channel requests timeout after 15 seconds. We recommend using the Asynchronous Webhook Channel if you expect the requests to take beyond 15 seconds.<\/li>\n<li><strong>Asynchronous Mode<\/strong>: Asynchronous mode is useful if you want to deliver the bot responses to a URL other than the incoming request\u2019s URL. You have to configure the POST_URL of your external system to enable the Async mode. The bot responses are asynchronously delivered to this POST_URL. Do note the that Kore.ai XO Platform does not provide the service to host the POST URL. You need to host a custom service or use a third-party service for this.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Step_1_Associate_an_App\">Step 1: Associate an App<\/span><\/h2>\n<p>To associate an App, follow the below steps:<\/p>\n<ol>\n<li>In the XO Platform, select the assistant to which you want to add the channel.<\/li>\n<li>Go to <strong>Deploy &gt; Channels &gt; Webhook<\/strong>.<\/li>\n<li>Go to the <b>Configurations<\/b> tab of this page and associate this channel with an app.<\/li>\n<li>Enter a <strong>Name<\/strong> for the channel.\n<ol>\n<li>Select one of these scopes for the app:\n<ul>\n<li>Allow anonymous users to chat with the assistant: enables anonymous users to interact with the assistant.<\/li>\n<li>Auto register new users on Kore.ai XO Platform: Select to control the auto-user registration in Kore.ai if the user assertion is unknown.<\/li>\n<\/ul>\n<\/li>\n<li>In the JWT Signing Algorithms Used For Client App Authentication drop-down list, select one of the following security algorithms:\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>RS256\/<\/b><b>RS512<\/b><b>: <\/b><span style=\"font-weight: 400;\">Select to enable the <\/span><b>Public Key.<\/b> <i><span style=\"font-weight: 400;\">The Private key, used for encryption, is provided by the user, and the Public key, used for decryption, is provided by the Platform<\/span><\/i><span style=\"font-weight: 400;\">. Both the keys have to be used for generating the token.<\/span><span style=\"font-weight: 400;\"> The Public Key is used by the XO Platform to authenticate the client application.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>HS256\/<\/b><b>HS512<\/b><b>:<\/b><span style=\"font-weight: 400;\"> Select to generate a <\/span><b>Secret Key <\/b><span style=\"font-weight: 400;\">and a <\/span><b>Client ID<\/b><span style=\"font-weight: 400;\">. The <\/span><b>Client ID<\/b><span style=\"font-weight: 400;\"> is required for app initialization, and the <\/span><b>Secret Key<\/b><span style=\"font-weight: 400;\"> is used by the XO Platform to authenticate the client application<\/span><\/li>\n<\/ul>\n<\/li>\n<li>Click Create. The app is created, and Client ID and Client Secret are generated. Copy the Client ID and Client Secret details<\/li>\n<\/ol>\n<\/li>\n<li>If you want to use the JSON Web Encryption (JWE) standard, you can view the <em>Public Key<\/em> by clicking the link provided below the <em>Client Secret<\/em> field.<\/li>\n<li>The Webhook channel supports both <strong>synchronous<\/strong> and <strong>asynchronous<\/strong> modes. Depending on your business needs, you can enable one of these modes in the <strong>Configurations<\/strong> tab.<\/li>\n<li>(Only for Webhook v2.0) In the <strong>Synchronous <\/strong>mode, by default, the <strong>Enable the Polling for Webhook v2 <\/strong> option is selected.<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/35\/20220928114925\/enable_webhook_v2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-46038\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220928114925\/enable_webhook_v2.jpg\" alt=\"\" width=\"400\" height=\"500\" \/><\/a><\/li>\n<li>Deselect the <strong>Enable the Polling in Webhook V2<\/strong> option to retrieve the complete response, all at once, without the need for polling.<br \/>\n<strong>Note<\/strong>: This option is available only in Webhook v2.0. <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/channel-enablement\/adding-webhook-channel\/#Webhook_V20\">Learn more<\/a>.<\/li>\n<li><span style=\"font-weight: 400;\">Select <\/span><b>Yes <\/b><span style=\"font-weight: 400;\">to<\/span><b> Enable Channel<\/b>.<\/li>\n<li><strong>Save<\/strong> the configuration. The Webhook URL in this channel instance is created dynamically.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/35\/20220906114508\/config-channel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-44223\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220906114508\/config-channel.png\" alt=\"\" width=\"291\" height=\"400\" \/><\/a><\/li>\n<\/ol>\n<h2><span class=\"ez-toc-section\" id=\"Step_2_Select_the_Integration_Mode\">Step 2: Select the Integration Mode<\/span><\/h2>\n<p>Use the <strong>Webhook URL<\/strong> to establish integration with external communication systems. This URL is available only after enabling the channel.<br \/>\n<a ref=\"magnificPopup\" href=\"\/wp-content\/uploads\/sites\/35\/20220906115242\/webhook-url.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-44227\" src=\"https:\/\/kore-wordpress.s3.us-east-2.amazonaws.com\/developer.kore.ai\/v10-1\/wp-content\/uploads\/sites\/35\/20220906115242\/webhook-url.png\" alt=\"\" width=\"345\" height=\"400\" \/><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Step_3_Deploy_the_Client_SDK_Optional\">Step 3: Deploy the Client SDK (Optional)<\/span><\/h2>\n<p>You may skip this step if you already have a messaging application to integrate with the Webhook channel. Optionally, you can use the Kore.ai Platform\u2019s Web\/Mobile <a href=\"https:\/\/github.com\/Koredotcom\/web-kore-sdk\">SDK libraries<\/a> to integrate with the Webhook channel.\u00a0 Use V2 of the Webhook APIs with synchronous mode for integrating with the client libraries. You can select the API version by going to the Instructions tab of the Webhook channel and scrolling down to Step 4.<\/p>\n<p>After completing these steps, a success message appears on the screen, and a channel request is sent to your Administrator for approval.<\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">The channel will be enabled for the end users only after the channel configurations are published. The publish request must be auto-approved or approved by the account admin.<\/span><\/li>\n<li>Webhook channel instances are included in the bot export copy, and are imported when the definition is imported into another bot. The channel instances are imported as placeholders, and you need to associate them with a valid app from the target VA.<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Step_4_Review_Payload_Formats\">Step 4: Review Payload Formats<\/span><\/h2>\n<p>To select the API Version for your integration, go to the Instructions tab of the Webhook channel you are working with. You can use the following code snippets of the payload formats to verify the integration. The Webhook API V2 is the latest version and includes a more standardized request and response payload.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Webhook_Endpoints\">Webhook Endpoints<\/span><\/h3>\n<p>The structure of the Webhook URL of the first instance varies from any additional instances enabled for the bot.<\/p>\n<ul>\n<li>In case you have either &#8211; only one webhook channel. Or for the first webhook channel in case you have multiple webhook channels configured:\n<pre>POST \u00a0{{host_url}}<i>\/chatbot\/hooks\/{{bot<\/i> id}}<\/pre>\n<\/li>\n<li>in case of multi-webhook configuration for the second instance onwards In case you have multiple webhook channels configured, this applies to the second instance onwards:\n<pre>POST  {{host_url}}\/chatbot\/hooks\/{{bot<i> id}}\/hookInstance\/{{webHookId}}  (This is auto-generated)<\/i><\/pre>\n<\/li>\n<\/ul>\n<h5><span style=\"font-weight: 400;\">Query Parameters<\/span><\/h5>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><b>Parameter<\/b><\/td>\n<td style=\"text-align: center;\"><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">host_url<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Your Kore.ai Bots Platform URL.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">bot id<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The ID of the bot to which you want to post messages. You can access it from the General Settings page of the bot.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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=\"Webhook_V10\">Webhook V1.0<\/span><\/h2>\n<p>Webhook version 1.0 supports simple request and response interfaces for enabling the communication between your custom channel interface and the platform. It is recommended to use the Webhook V2.0 as it supports standardized and modular payloads for exchanging messages and events.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Interaction_Flow\">Interaction Flow<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th><b>Scenario<\/b><\/th>\n<th><b>Synchronous Mode<br \/>\n<\/b><\/th>\n<th><b>Asynchronous Mode<br \/>\n<\/b><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">Single Response<\/span><\/td>\n<td><span style=\"font-weight: 400;\">VA responses are sent as a response to the incoming request.<\/span><\/td>\n<td>VA response is sent to the Post_URL configured as part of the channel configurations.<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Multiple consecutive response nodes<\/span><\/td>\n<td><span style=\"font-weight: 400;\">VA responses are sent as an array to the incoming request.<\/span><\/td>\n<td>Each of the bot response is sent to the Post_URL configured as part of the channel configurations<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Multiple response nodes with service \/ script \/ webhook nodes in between<\/span><\/td>\n<td><span style=\"font-weight: 400;\">The platform completes the service \/ script \/ webhook execution and sends the bot responses as an array to the incoming request.<\/span><\/td>\n<td>Each of the bot response is sent to the Post_URL after processing the relevant service \/ script \/ webhook nodes.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"Authorization\"><span style=\"font-weight: 400;\">Authorization<\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Invoke the API with JWT in the header with the following syntax:<\/span><\/p>\n<pre>Authorization<span style=\"font-weight: 400;\">: bearer {{JWT}}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Generate JWT using the following header and payload <a href=\"\/docs\/bots\/api-guide\/apis\/#Generating_JWT_Token\" target=\"_blank\" rel=\"noopener noreferrer\">from this page<\/a>.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Response_content_type\"><span style=\"font-weight: 400;\">Response content type<\/span><\/span><\/h3>\n<pre>application\/json<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Request_Parameters\">Request Parameters<\/span><\/h3>\n<p>The following are the parameters required\/supported in the v1.0 of the Webhook channel<\/p>\n<table>\n<thead>\n<tr>\n<th><b>Parameter Name<\/b><\/th>\n<th><b>Description<br \/>\n<\/b><\/th>\n<th><b>Data Type<br \/>\n<\/b><\/th>\n<th><b>Required\/Optional<\/b><\/th>\n<th><b>Possible Values<\/b><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<pre>session<\/pre>\n<\/td>\n<td>Details of how the conversation session should be handled.<\/td>\n<td>Objects.<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>new<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Parameter to define whether to start a new conversion or continue with the existing.<\/span><\/td>\n<td>Boolean<\/td>\n<td>Optional<\/td>\n<td>\n<ul>\n<li>true<\/li>\n<li>false<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>message<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Includes the contents of the incoming request to the bot.<\/span><\/td>\n<td>Object<\/td>\n<td>Required<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>text<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The message text to be sent to the bot.<\/span><\/td>\n<td>String<\/td>\n<td>Required<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>attachments<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The list of attachments to be passed to the bot.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>\n<pre>{\"url\":\"https:\/\/- - \"}<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>from<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Details of the request origin. It usually includes user information.<\/span><\/td>\n<td>Object<\/td>\n<td>Required<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>id<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The unique identity of the user interacting with the bot.<\/span><\/td>\n<td>String<\/td>\n<td>Required<\/td>\n<td>Usually a random string, alphanumeric number, email id etc.,<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>userInfo<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The user profile information.<\/span><\/td>\n<td>Object<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>firstName<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The first name of the user.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>lastName<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The last name of the user.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>email<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The email address of the user.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>userLevelTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Array of user level meta tags to be added to the current user.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>Every tag to be added using \u201cname\u201d and \u201cvalue\u2019 keys.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>sessionLevelTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Array of session level meta tags to be added to the current conversion session.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>Every tag to be added using \u201cname\u201d and \u201cvalue\u2019 keys.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>messageLevelTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Array of message level tags to be added to the current message.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>Every tag to be added using \u201cname\u201d and \u201cvalue\u2019 keys.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>mergeIdentity<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">To merge the current conversation with any other conversation in progress.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>true<\/li>\n<li>false<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&lt;\/ul<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>preferredChannelForResponse<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">To request the platform to provide a response for a different channel. By default, the platform provides the Webhook channel (instance) related responses.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>Any valid channel name.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>customData<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">To send additional custom data from the Webhook channel by including it in the request payload.<\/span><\/td>\n<td>Object<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"Sample_Request_Payload_Reference\"><span style=\"font-weight: 400;\">Sample Request Payload Reference<\/span><\/span><\/h3>\n<p>Below is the Webhook v1 payload format to send messages to the Kore.ai XO Platform:<\/p>\n<pre>curl -X POST 'https:\/\/bots.kore.ai\/chatbot\/hooks\/st-xxxxxxxx-1dbc-xxx-aa8f-1fxxx6626ea' \\\r\n--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInxxxxxxxxxxxxxxxxxxxxxxxxQ3LTcwYTlmOTg3Yjg0NCJ9._pztYVnP2UfJNu4-xxxxT19tsM-hkU3gU7a6lU' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data '{\r\n    \"session\": {\r\n        \"new\": false\r\n    },\r\n    \"message\": {\r\n        \"text\": \"asdf\",\r\n        \"attachments\": [\r\n            {\r\n                \"fileId\": \"6511643xxxxxxx19b79\",\r\n                \"fileType\": \"txt\",\r\n                \"fileName\": \"IVR Doc\"\r\n            }\r\n        ]\r\n    },\r\n    \"from\": {\r\n        \"id\": \"xxxx12xxx6\",\r\n        \"userInfo\": {\r\n            \"firstName\": \"\",\r\n            \"lastName\": \"\",\r\n            \"email\": \"\"\r\n        }\r\n    }\r\n}'\r\n<\/pre>\n<p>You can send additional data from the Webhook channel by including it in the request payload using the <em>customData<\/em> object. The <em>customData<\/em> along with the full payload will be available as part of the <em>context.session.BotUserSession.lastMessage<\/em> object.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Response\">Response<\/span><\/h3>\n<p>The response contains the following fields:<\/p>\n<ul>\n<li><em>to<\/em>\u2013 refers to the user to whom the message is delivered to.<\/li>\n<li><em>from <\/em>\u2013 identity (Stream Id) of the bot from which the response is generated.<\/li>\n<li><em>text <\/em> \u2013 contains the response(s) from the bot. Can be a string, object or an array of strings or objects.<\/li>\n<li><em>endOfTask <\/em>\u2013 indicating whether the task was completed or not, values <em>true<\/em> or <em>false<\/em>.<\/li>\n<li><em>endReason<\/em>\u2013 the reason for the task completion \u2013 <em>fulfilled<\/em>, <em>interrupted<\/em>, or <em>canceled <\/em><\/li>\n<li><em>completedTaskId<\/em>\u2013 the id of the dialog task triggered.<\/li>\n<li><em>completedTaskName <\/em>\u2013 the name of the dialog task triggered.<\/li>\n<\/ul>\n<p>If the bot response is a template, then the JSON object required for rendering the template is included in the \u2018text\u2019 field as an object or array of objects.<\/p>\n<pre>\"customData\": {\"name\":\"John\",\"age\":30,\"cars\": \r\n                             {\"car1\":\"Ford\",\"car2\":\"BMW\",\"car3\":\"Fiat\"}},<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Sample_Response_for_Synchronous_Mode\"><span style=\"font-weight: 400;\">Sample Response for Synchronous Mode<\/span><\/span><\/h3>\n<pre>{\r\n  \"text\": [\r\n            \"You have $45,000 in your Salary account.\",\r\n            \"Let me know if you need any other assistance\"\r\n           ],\r\n  \"endOfTask\": true,\r\n  \"endReason\": \"Fulfilled\",\r\n  \"completedTaskId\": \"dg-eb0cc36e-06ac-5bff-8234-e4adf501a2ef\",\r\n  \"completedTaskName\": \"show balance\"\r\n}<\/pre>\n<p><strong>Note<\/strong>: The \u2018text\u2019 field can contain a string, object or an array of strings or objects.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Sample_Response_for_Asynchronous_Mode\">Sample Response for Asynchronous Mode<\/span><\/h3>\n<pre>{\r\n\"to\": \"john.doe@kore.com\",\r\n\"from\": \"st-b3a3dc49-bd57-5c5d-b12c-8e3776192a4c\",\r\n\"text\": \"Your available account balance is $31,439.\",\r\n}\r\n<\/pre>\n<p>For Asynchronous integration mode, the platform sends an acknowledgement response to the incoming request with Status Code as 200. The bot response to be delivered to the user is sent to the <em>Post_URL<\/em> configured for the channel.<\/p>\n<ul>\n<li>The <em>text<\/em> field can contain a string, object or an array of strings or objects.<\/li>\n<li>Separate messages are sent for every bot response to be delivered to the user.<\/li>\n<li>The conversation flow related fields like &#8220;<em>endOfTask<\/em>&#8220;, &#8220;<em>endReason<\/em>&#8220;, &#8220;<em>completedTaskId<\/em>&#8221; and &#8220;<em>completedTaskName<\/em>&#8220;: &#8220;show balance&#8221; are delivered as a separate message.<\/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=\"Webhook_V20\">Webhook V2.0<\/span><\/h2>\n<p>The Webhook V2 API provides a more standardized and modular payload format and additional conversation management capabilities.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Interaction_Flow-2\">Interaction Flow<\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th><b>Scenario<\/b><\/th>\n<th><b>Synchronous Mode<br \/>\n<\/b><\/th>\n<th><b>Asynchronous Mode<br \/>\n<\/b><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">Single Response<\/span><\/td>\n<td><span style=\"font-weight: 400;\">VA response is sent as a response to the incoming request.<\/span><\/td>\n<td>VA response is sent to the <em>Post_URL<\/em> configured as part of the channel configurations.<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Multiple consecutive response nodes<\/span><\/td>\n<td><span style=\"font-weight: 400;\">VA responses are sent as an array to the incoming request.<\/span><\/td>\n<td>Each of the bot response is sent to the <em>Post_URL<\/em> configured as part of the channel configurations<\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Multiple response nodes with service \/ script \/ webhook nodes in between<\/span><\/td>\n<td>&nbsp;<\/p>\n<ul>\n<li>The consecutive messages are delivered to the request along with a \u2018pollid&#8217;.<\/li>\n<li>The platform initiates the execution of service \/ script \/ webhook nodes.<\/li>\n<li>The client should poll the platform using the \u2018pollid\u2019 at short intervals.<\/li>\n<li>The platform responds to the poll request with the status of the execution. If the execution is complete, then the response will include the next set of consecutive messages.<\/li>\n<\/ul>\n<\/td>\n<td>Each of the VA response is sent to the Post_URL after processing the relevant service \/ script \/ webhook nodes.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"Authorization-2\"><span style=\"font-weight: 400;\">Authorization<\/span><\/span><\/h3>\n<h4>User Identity<\/h4>\n<p><span style=\"font-weight: 400;\">The Webhook V2.0 allows you to authenticate the API call with JWT token user identity. If the user identity (\u2018from\u2019 field) exists in both the request the payload and JWT token, then the Webhook v2 validates the user identity. Use the following payload for authentication with user identity:<\/span><\/p>\n<h4>JWT Payload<\/h4>\n<pre>{\r\n  \"appId\": \"{{clientId of the bot}}\",\r\n  \"sub\" : \"{{random number}}\"\r\n  \"userIdentity\": \"{{unique user identity}}\",\r\n  \"iat\" : 161639822 \r\n  }\r\n<\/pre>\n<ul>\n<li>If the <em>userIdentity <\/em>is not present in JWT, you can validate the <em>userIdentity <\/em> authentication using the appId and the <em>from <\/em>value will be used to generate the userId in the Kore platform..<\/li>\n<li>If the <em>userIdentity <\/em>is present in JWT as well as <em>from <\/em>but both are NOT same, then authentication will be failed and throws an error saying that Invalid access token.<\/li>\n<li>The <em>userIdentity <\/em> is present in JWT, and <em>from<\/em> is present in the webhook payload, and both <em>userIdentity <\/em> and <em>from<\/em> are the same, then it will check against the authentication against the appId and proceed further.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Request_Parameters-2\">Request Parameters<\/span><\/h3>\n<p>The following are the parameters required\/supported in the v2.0 of the Webhook channel.<\/p>\n<table>\n<thead>\n<tr>\n<th><b>Parameter Name<\/b><\/th>\n<th><b>Description<br \/>\n<\/b><\/th>\n<th><b>Data Type<br \/>\n<\/b><\/th>\n<th><b>Required\/Optional<\/b><\/th>\n<th><b>Possible Values<\/b><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\n<pre>session<\/pre>\n<\/td>\n<td>Details of how the conversation session should be handled.<\/td>\n<td>Objects.<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>new<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Parameter to define whether to start a new conversion or continue with the existing.<\/span><\/td>\n<td>Boolean<\/td>\n<td>Optional<\/td>\n<td>\n<ul>\n<li>true<\/li>\n<li>false<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>message<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Includes the contents of the incoming request to the bot.<\/span><\/td>\n<td>Object<\/td>\n<td>Required<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>type<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The type of message sent to the platform.<\/span><\/td>\n<td>String<\/td>\n<td>Required<\/td>\n<td>\n<ul>\n<li><span style=\"font-weight: 400;\">\u201c<\/span><i><span style=\"font-weight: 400;\">text<\/span><\/i><span style=\"font-weight: 400;\">\u201d &#8211; If you want to send a plain text message.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u201c<\/span><i><span style=\"font-weight: 400;\">template<\/span><\/i><span style=\"font-weight: 400;\">\u201d or \u201c<\/span><i><span style=\"font-weight: 400;\">formData<\/span><\/i><span style=\"font-weight: 400;\">\u201d &#8211; If you want to send a JavaScript template message or form data. <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><b>Note<\/b><span style=\"font-weight: 400;\">: Ensure that you send only a JSON object.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\u201c<\/span><i><span style=\"font-weight: 400;\">event<\/span><\/i><span style=\"font-weight: 400;\">\u201d &#8211; If you want to trigger the \u201cON_CONNECT\u201d and \u201c<\/span><i><span style=\"font-weight: 400;\">SESSION_CLOSURE<\/span><\/i><span style=\"font-weight: 400;\">\u201d events.<\/span><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>val<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The value of the sent message.<\/span><\/td>\n<td>String or Object<\/td>\n<td>Required<\/td>\n<td>\n<ul>\n<li>If the type = \u201c<em>text<\/em>\u201d then the <em>val <\/em> will be String.<\/li>\n<li>If the type = \u201c<em>template<\/em>\u201d or \u201c<em>formData<\/em>\u201d then the <em>val<\/em> will be Object.<\/li>\n<li><span style=\"font-weight: 400;\">If you want to trigger the on-connect event, then type = \u201c<\/span><i><span style=\"font-weight: 400;\">event<\/span><\/i><span style=\"font-weight: 400;\">\u201d and the <\/span><i><span style=\"font-weight: 400;\">val<\/span><\/i><span style=\"font-weight: 400;\"> must be \u201c<\/span><i><span style=\"font-weight: 400;\">ON_CONNECT.<\/span><\/i><span style=\"font-weight: 400;\">\u201d<\/span><\/li>\n<li><span style=\"font-weight: 400;\">If you want to close the active session, then type = \u201c<\/span><i><span style=\"font-weight: 400;\">event<\/span><\/i><span style=\"font-weight: 400;\">\u201d and the <\/span><i><span style=\"font-weight: 400;\">val<\/span><\/i><span style=\"font-weight: 400;\"> must be \u201c<\/span><i><span style=\"font-weight: 400;\">SESSION_CLOSURE.\u201d<\/span><\/i><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>attachments<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The list of attachments to be passed to the VA.<\/span><\/p>\n<p><b>Note<\/b><span style=\"font-weight: 400;\">: <\/span><span style=\"font-weight: 400;\">If attachment is used, set <\/span><b>type <\/b><span style=\"font-weight: 400;\">as <\/span><i><span style=\"font-weight: 400;\">text <\/span><\/i><span style=\"font-weight: 400;\">and the <\/span><b>val <\/b><span style=\"font-weight: 400;\">parameter cannot be blank and it has to contain some user utterance.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>\n<pre>{\"url\":\"https:\/\/- - \"},\r\n{ \"fileName\": \"Kore_ai_Logo.png\", \"fileType\":\"image\", \"fileId\": \"6163e17bf60e0xxxxxxxx\" }\r\n<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>from<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Details of the request origin. It usually includes user information.<\/span><\/td>\n<td>Object<\/td>\n<td>Required<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>id<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The unique identity of the user interacting with the VA.<\/span><\/td>\n<td>String<\/td>\n<td>Required<\/td>\n<td>Usually a random string, alphanumeric number, email id etc.,<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>InteractiveLanguage<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The interaction language of the virtual assistant.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>Any language that is configured for the VA.<br \/>\nFor the list of Supported Bot Languages, read <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/multi-lingual\/building-multi-language-bots\/#Supported_Bot_Languages\">Getting Started with Multilingual Virtual Assistant<\/a> article.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>userInfo<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The user profile information.<\/span><\/td>\n<td>Object<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>firstName<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The first name of the user.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>lastName<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The last name of the user.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>email<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">The email address of the user.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>metaTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Refers to the meta tags to be added.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>userLevelTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Array of user level meta tags to be added to the current user.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>Every tag to be added using \u201cname\u201d and \u201cvalue\u2019 keys.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>sessionLevelTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Array of session level meta tags to be added to the current conversion session.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>Every tag to be added using \u201cname\u201d and \u201cvalue\u2019 keys.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>messageLevelTags<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">Array of message level tags to be added to the current message.<\/span><\/td>\n<td>Array of Objects<\/td>\n<td>Optional<\/td>\n<td>Every tag to be added using \u201cname\u201d and \u201cvalue\u2019 keys.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>mergeIdentity<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">To merge the current conversation with any other conversation in progress.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>true<\/li>\n<li>false<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&lt;\/ul<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>preferredChannelForResponse<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">To request the platform to provide a response for a different channel. By default, the platform provides the Webhook channel (instance) related responses.<\/span><\/td>\n<td>String<\/td>\n<td>Optional<\/td>\n<td>Any valid channel name.<\/td>\n<\/tr>\n<tr>\n<td>\n<pre>customData<\/pre>\n<\/td>\n<td><span style=\"font-weight: 400;\">To send additional custom data from the Webhook channel by including it in the request payload.<\/span><\/td>\n<td>Object<\/td>\n<td>Optional<\/td>\n<td>N\/A<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"Sample_Request\"><span style=\"font-weight: 400;\">Sample Request<\/span><\/span><\/h3>\n<p>Below is the Webhook v2.0 payload format to send messages to the Kore.ai XO Platform:<\/p>\n<pre>curl -X POST 'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-e4xxxxa3-1dbc-xxxx-aa8f-1f2xxx626ea' \\\r\n--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInxxxxxxxxxxxxxxxxxxxxxxxxQ3LTcwYTlmOTg3Yjg0NCJ9._pztYVnP2UfJNu4-Unwx5eM7qT19tsM-hkU3gU7a6lU' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data '{\r\n    \"session\": {\r\n        \"new\": false\r\n    },\r\n    \"message\": {\r\n        \"type\": \"text\",\r\n        \"val\": \"asdg\",\r\n        \"attachments\": [\r\n            {\r\n                \"fileId\": \"65116439cd838811d9819b79\",\r\n                \"fileType\": \"txt\",\r\n                \"fileName\": \"IVR Doc\"\r\n            }\r\n        ]\r\n    },\r\n    \"from\": {\r\n        \"id\": \"New1234\",\r\n        \"userInfo\": {\r\n            \"firstName\": \"\",\r\n            \"lastName\": \"\",\r\n            \"email\": \"\"\r\n        }\r\n    },\r\n    \"metaTags\": {\r\n        \"userLevelTags\": [\r\n            {\r\n                \"name\": \"\",\r\n                \"value\": \"\"\r\n            }\r\n        ],\r\n        \"sessionLevelTags\": [\r\n            {\r\n                \"name\": \"\",\r\n                \"value\": \"\"\r\n            }\r\n        ],\r\n        \"messageLevelTags\": [\r\n            {\r\n                \"name\": \"\",\r\n                \"value\": \"\"\r\n            }\r\n        ]\r\n    },\r\n    \"mergeIdentity\": true,\r\n    \"preferredChannelForResponse\": \"rtm\",\r\n    \"customData\": {\r\n        \"customText\": \"This is generated by customData\"\r\n    }\r\n}'\r\n\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"OnConnect_Event_Request\">OnConnect Event Request<\/span><\/h3>\n<p>The Webhook V2.0 supports the OnConnect event as part of the first user message. You can pass the OnConnect as an event parameter. Here is an example on how to trigger the onConnect event:<\/p>\n<pre>curl -x POST 'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-e4xxxa3-1dbc-xxxx-aa8f-1f225xxxx6ea' \\\r\n--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInxxxxxxxxxxxxxxxxxxxxxxxxQ3LTcwYTlmOTg3Yjg0NCJ9._pztYVnP2UfJNu4-Unwx5eM7qT19tsM-hkU3gU7a6lU' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data '{\r\n    \"session\": {\r\n        \"new\": true\r\n    },\r\n    \"message\": {\r\n        \"type\": \"event\",\r\n        \"val\": \"ON_CONNECT\"\r\n    },\r\n    \"from\": {\r\n        \"id\": \"Kore9\",\r\n        \"userInfo\": {\r\n            \"firstName\": \"\",\r\n            \"lastName\": \"\",\r\n            \"email\": \"\"\r\n        }\r\n    }\r\n}'\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Response-2\">Response<\/span><\/h3>\n<p>The response contains the following fields:<\/p>\n<ul>\n<li><em>to<\/em>\u2013 refers to the user to whom the message is delivered to.<\/li>\n<li><em>from <\/em>\u2013 identity (Stream Id) of the bot from which the response is generated.<\/li>\n<li><em>text <\/em> \u2013 contains the response(s) from the bot. Can be a string, object or an array of strings or objects.<\/li>\n<li><em>endOfTask <\/em>\u2013 indicating whether the task was completed or not, values <em>true<\/em> or <em>false<\/em>.<\/li>\n<li><em>endReason<\/em>\u2013 the reason for the task completion \u2013 <em>fulfilled<\/em>, <em>interrupted<\/em>, or <em>canceled <\/em><\/li>\n<li><em>completedTaskId<\/em>\u2013 the <em>id <\/em>of the dialog task triggered.<\/li>\n<li><em>completedTaskName <\/em>\u2013 the name of the dialog task triggered.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Change_Conversation_Language_Request\">Change Conversation Language Request<\/span><\/h3>\n<p>To change the language of an ongoing conversation, you can pass the <code>interactiveLanguage<\/code> as a parameter with a value (language code) of one of the configured VA languages.<\/p>\n<p>To change the conversation language from English (en) to French (fr), pass the value as \u201cfr\u201d in the <code>interactiveLanguage<\/code> parameter:<\/p>\n<p><b>Sample Request<\/b><\/p>\n<pre>curl -X POST 'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-a77a38cd-xxxx-xxxx-81c6-227xxxx8d48' \\\r\n--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInxxxxxxxxxxxxxxxxxxxxxxxxQ3LTcwYTlmOTg3Yjg0NCJ9._pztYVnP2UfJNu4-Unwx5eM7qT19tsM-hkU3gU7a6lU' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data '{\r\n    \"session\": {\r\n        \"new\": false\r\n    },\r\n    \"message\": {\r\n        \"type\": \"text\",\r\n        \"val\": \"hola\"\r\n    },\r\n    \"from\": {\r\n        \"id\": \"Kore987\"\r\n    },\r\n    \"to\": {\r\n        \"id\": \"st-9ed05a51-3c93-xxxx-xxx-c41xxxx3b0e1\"\r\n    },\r\n    \"interactiveLanguage\": \"fr\"\r\n}'\r\n\r\n<\/pre>\n<p>For the list of Supported Bot Languages codes, read <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/advanced-topics\/multi-lingual\/building-multi-language-bots\/#Supported_Bot_Languages\">Getting Started with Multilingual Virtual Assistant<\/a> article.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Close_Conversation_Session_Event_Request\">Close Conversation Session Event Request<\/span><\/h3>\n<p>The Webhook V2.0 supports the closeConversationSession event as part of the user message. You can pass the <code>Session_Closure<\/code> as an event parameter.<\/p>\n<p>Here is a sample request to trigger the <code>Session_Closure<\/code> event:<\/p>\n<p><b>Sample Request<\/b><\/p>\n<pre>curl -X POST 'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-xxx5a51-xxxx-56bb-af81-c41ff9b3b0e1' \\\r\n--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInxxxxxxxxxxxxxxxxxxxxxxxxQ3LTcwYTlmOTg3Yjg0NCJ9._pztYVnP2UfJNu4-Unwx5eM7qT19tsM-hkU3gU7a6lU' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data '{\r\n    \"session\": {\r\n        \"new\": false\r\n    },\r\n    \"message\": {\r\n        \"type\": \"event\",\r\n        \"val\": \"SESSION_CLOSURE\"\r\n    },\r\n    \"from\": {\r\n        \"id\": \"xxx1234xxx\"\r\n    },\r\n    \"to\": {\r\n        \"id\": \"st-9ed05a51-3c93-xxxx-xxx-c41xxxx3b0e1\"\r\n    }\r\n}'\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Sample_Responses\">Sample Responses<\/span><\/h3>\n<p>The following are the possible response scenarios.<\/p>\n<h4>Sample Response for Synchronous Mode<\/h4>\n<p><strong>Scenario 1<\/strong>: Response without need for polling<\/p>\n<p>The platform delivers the message or messages to the client and waits for the user input to continue any ongoing flow or initiate a new flow.<\/p>\n<pre>Response:\r\n{\r\n \"to\": \"john.doe@kore.com\",\r\n \"from\": \"st-b3a3dc49-bd57-5c5d-b12c-xxxxxxxxxx\",\r\n \"data\": [\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"The balance in your Salary Account ending with 3984 is $54,883\",\r\n            \"createdOn\": \"2022-05-11T06:27:06.764Z\",\r\n            \"messageId\": \"ms-16535527-0f27-5116-bee3-xxxxxxxx\"\r\n        },\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"The balance in your Checking Account ending with 9964 is $21,657\",\r\n            \"createdOn\": \"2022-05-11T06:27:07.032Z\",\r\n            \"messageId\": \"ms-e3e92480-3d23-50a7-a2e5-xxxxxxxxxxx\"\r\n        }\r\n    ],\r\n    \"_v\": \"v2\",\r\n    \"endOfTask\": false,\r\n    \"endReason\": \"Fulfilled\",\r\n    \"completedTaskId\": \"dg-79950d7e-cdc6-5ff4-a4be-xxxxxxxxx\",\r\n    \"completedTaskName\": \"Show Balance\"\r\n}\r\n<\/pre>\n<p><strong>Scenario 2<\/strong>: Responses with need for polling<\/p>\n<p>If there are one or more Service \/ Script \/ Webhook nodes between messages, the platform delivers the messages along with a \u2018pollid\u2019 to the incoming request. The client should implement a polling framework to process the flow using the \u2018pollid\u2019 provided by the platform.<\/p>\n<ul>\n<li>The platform delivers the first message or set of consecutive messages along with a \u2018<em>pollid<\/em>\u2019 to the incoming request.<\/li>\n<li>The client should make a poll request to the platform using the \u2018<em>pollid<\/em>\u2019 provided by the platform in the response to the original request.<\/li>\n<li>The response to the poll request can result in one of the following:\n<ul>\n<li>The \u2018<em>status<\/em>\u2019 is returned as \u2018<em>Inprogress<\/em>\u2019 if the execution of service \/ script \/ webhook nodes is still in progress.<\/li>\n<li>The response will include the message payload if the execution of service \/ script \/ webhook is completed.<\/li>\n<li>The response will give an error message if the message for a \u2018<em>pollid<\/em>\u2019 is already delivered to the client.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Sample request with messages and &#8216;pollid&#8217;<\/strong><\/p>\n<pre>curl -X GET 'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-8e031d0a-xxxx-xxx-bf4c-b8axxxf0685\/poll\/7c1a981xxxxxxxxd9dbcb9345af39b2d' \\\r\n--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInxxxxxxxxxxxxxxxxxxxxxxxxQ3LTcwYTlmOTg3Yjg0NCJ9._pztYVnP2UfJNu4-Unwx5eM7qT19tsM-hkU3gU7a6lU'\r\n\r\n<\/pre>\n<p><strong>Sample response with messages and \u2018pollid\u2019<\/strong><\/p>\n<p>The platform delivers the first message or set of consecutive messages along with a \u2018pollid\u2019 to the incoming request. The platform initiates the execution of Service \/ Script \/ Webhook nodes.<\/p>\n<pre>{\r\n    \"data\": [\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"Sample message for Message0013\",\r\n            \"createdOn\": \"2022-05-11T06:48:50.801Z\",\r\n            \"messageId\": \"ms-3a3538a7-91b8-5c09-af72-xxxxxxxx\"\r\n        }\r\n    ],\r\n    \"_v\": \"v2\",\r\n    \"pollId\": \"a69b1077c3541e76253be58aa340950b\"\r\n}\r\n<\/pre>\n<p><strong>Response to poll request when the execution is in progress<\/strong><\/p>\n<pre>URL:\t   \/chatbot\/v2\/webhook\/:streamId\/pollId\r\nMethod: GET\r\n{\r\n   \"status\": \"Inprogress\",\r\n   \"pollId\": \"a89627d5b85ba70257871bxxxxxxxxxe\",\r\n   \"_v\": \"v2\"\r\n}\r\n<\/pre>\n<p><strong>Response to poll request when the execution is complete<\/strong><\/p>\n<p>If the processing of service \/ script \/ webhook is completed, then the platform responds to the poll request with the message payload.<\/p>\n<ul>\n<li>The response format will be the same the regular response.<\/li>\n<li>If the flow execution includes execution of service \/ script \/ webhook nodes, then the response will include a new \u2018pollid\u2019 to be used for subsequent execution.<\/li>\n<\/ul>\n<p><strong>Response to expired poll request<\/strong><\/p>\n<p>The messages for a \u2018pollid\u2019 are provided by the platform only once. The platform responds with an error message if the client makes a poll request for a \u2018pollid\u2019 for which the platform has already delivered the messages.<\/p>\n<pre>{\r\n   \"errors\": [\r\n       {\r\n           \"msg\": \"No data found\",\r\n           \"code\": 400\r\n       }\r\n   ]\r\n}\r\n<\/pre>\n<p><strong>Response when polling is disabled<\/strong><\/p>\n<p>When you deselect the <strong>Enable the Polling in Webhook V2 <\/strong>option in the <strong>Configurations <\/strong>tab, the platform retrieves the complete response, all at once, without the need for polling. <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/channel-enablement\/adding-webhook-channel\/#Step_1_Associate_an_App\">Learn more<\/a>.<\/p>\n<p>Sample Response:<\/p>\n<pre>{\r\n\"data\": [\r\n{\r\n\"type\": \"text\",\r\n\"val\": \"\"The City Name is Kondapur\"\"The State Name is Telangana\"\",\r\n\"createdOn\": \"2022-09-29T07:17:52.451Z\",\r\n\"messageId\": \"ms-e941520d-a512-5dac-98e3-xxxxxxxxx\"\r\n},\r\n{\r\n\"type\": \"text\",\r\n\"val\": \"End of Conversation Event\",\r\n\"createdOn\": \"2022-09-29T07:17:52.741Z\",\r\n\"messageId\": \"ms-e9473e2b-a8f8-5628-9146-xxxxxxxxx\"\r\n}\r\n],\r\n\"_v\": \"v2\",\r\n\"endOfTask\": true,\r\n\"endReason\": \"Fulfilled\",\r\n\"completedTaskId\": \"dg-2e50c369-ae83-50cb-9abf-xxxxxxxx\",\r\n\"completedTaskName\": \"get state name\"\r\n}\r\n<\/pre>\n<p><strong>Response as a Request to Post URL<\/strong><\/p>\n<p>Then use the <em>pollId <\/em>from the Response#1 to get the response of the second Message node.<\/p>\n<p>Here is the sample curl to use pollId to fetch the response:<\/p>\n<pre>    \"data\": [\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"Current weather haze\",\r\n            \"createdOn\": \"2022-05-11T06:48:51.545Z\",\r\n            \"messageId\": \"ms-0421201b-6c7e-59a6-9246-xxxxxxxxx\"\r\n        },\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"Let me know if you need any other assistance\",\r\n            \"createdOn\": \"2022-05-11T06:48:52.138Z\",\r\n            \"messageId\": \"ms-c533f0d8-4495-58f8-9839-xxxxxxxxxx\"\r\n        }\r\n    ],\r\n    \"_v\": \"v2\",\r\n    \"endOfTask\": true,\r\n    \"endReason\": \"Fulfilled\",\r\n    \"completedTaskId\": \"dg-xxxxx-xxxx-xxxx-xxxx-xxxxxxx\",\r\n    \"completedTaskName\": \"current weather\"\r\n}'\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Change_Conversation_Language_Response\"><strong>Change Conversation Language Response<\/strong><\/span><\/h3>\n<p>Here is the sample response for the change conversation language:<\/p>\n<pre>{\r\n    \"data\": [\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"\"Voici les t\u00e2ches que je peux effectuer pour vous.\\n a) ADialog \\n b) BDialog \\n c) Get user data \\n \r\n            d) Raise Complain \\n e) Search song \\n\",\r\n            \"createdOn\": \"2022-07-28T07:06:55.843Z\",\r\n             \"messageId\": \"ms-d4ca9e2e-6d2d-xxxx-xxxx-xxxxxxxxx\"\r\n\r\n        },\r\n        {\r\n            \"type\": \"text\",\r\n            \"val\": \"Salut, comment puis-je vous aider?\",\r\n            \"createdOn\": \"2022-07-28T07:06:55.843Z\",\r\n            \"messageId\": \"ms-d4ca9e2e-6d2d-xxxx-xxxx-xxxxxxxxx\"\r\n        }\r\n    ],\r\n    \"_v\": \"v2\",\r\n    \"endOfTask\": true,\r\n    \"endReason\": \"Fulfilled\",\r\n    \"completedTaskId\": \"dg-xxxxx-xxxx-xxxx-xxxx-xxxxxxx\",\r\n    \"completedTaskName\": \"welcome_task\"\r\n}\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Close_Conversation_Session_Event_Responses\"><strong>Close Conversation Session Event Responses<\/strong><\/span><\/h3>\n<p>Here are sample responses for the <code>SESSION_CLOSURE<\/code>:<\/p>\n<p><strong>Response 1: When an active session exists<\/strong><\/p>\n<pre>{\r\n    \"data\": [\r\n        {\r\n            \"type\": \"event\",\r\n            \"val\": \"SESSION_CLOSURE\",\r\n            \"eventType\": \"SESSION_CLOSURE_SUCCESS\",\r\n             \"description\": \"session closed successfully\",\r\n        }\r\n      ],\r\n   \"_v\": \"v2\"\r\n}\r\n<\/pre>\n<p><strong>Response 1: When an active session does not exist<\/strong><\/p>\n<pre>{\r\n    \"data\": [\r\n        {\r\n            \"type\": \"event\",\r\n            \"val\": \"SESSION_CLOSURE\",\r\n            \"eventType\": \"SESSION_CLOSURE_IGNORED\",\r\n             \"description\": \"Active session doesn't exist\"\r\n         ], \r\n        \"_v\": \"v2\"\r\n}\r\n<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Sample_Response_for_Asynchronous_Mode-2\">Sample Response for Asynchronous Mode<\/span><\/h3>\n<p>The POST_URL is the customer&#8217;s own asynchronous URL to send and receive requests. Kore.ai does not provide any POST _URL for Asynchronous setup because this URL is different from customer to customer.<\/p>\n<p>The following response is an example for a successful asynchronous call:<\/p>\n<h4>Request Acknowledgement<\/h4>\n<pre>{\r\n  \"status\": \"ok\"\r\n  \"_v\": \"v2\",\r\n  \"traceId\":\"RTM-TRACE-9JOHE3ALB\"\r\n}\r\n<\/pre>\n<h4>Response as a Request to Post URL<\/h4>\n<pre>{\r\n   \"data\": [\r\n       {\r\n           \"type\": \"text\",\r\n           \"val\": \"Please provide your account number\",\r\n           \"createdOn\": \"2021-10-11T13:44:34.675Z\"\r\n       }\r\n   ],\r\n   \"_v\": \"v2\",\r\n}\r\n<\/pre>\n<p>For Asynchronous integration mode, the platform sends an acknowledgement response to the incoming request with Status Code as 200. The bot response to be delivered to the user is sent to the Post_URL configured for the channel.<\/p>\n<ul>\n<li>The \u2018text\u2019 field can contain a string, object or an array of strings or objects.<\/li>\n<li>Separate messages are sent for every bot response to be delivered to the user.<\/li>\n<li>The conversation flow related fields like &#8220;<em>endOfTask<\/em>&#8220;, &#8220;<em>endReason<\/em>&#8220;, &#8220;<em>completedTaskId<\/em>&#8221; and &#8220;<em>completedTaskName<\/em>&#8220;: &#8220;show balance&#8221; are delivered as a separate message.<\/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=\"Support_for_Attachments\">Support for Attachments<\/span><\/h2>\n<p>The Webhook API can be used to send attachments from the end users to the bot. Files can be sent in multiple ways.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Option_1_Upload_Files_from_Web_URLs\">Option 1: Upload Files from Web URLs<\/span><\/h3>\n<h4><b>Type 1 : Upload File with URL<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">You can upload files hosted on external services by providing the Web URL of the file location. Make sure that the URL is accessible by the platform. <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">curl -X POST \r\n'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-4xxx3f-xxx-5657-xxx-a8cxxxxa086\/hookInstance\/ivrInst-c867xx54-e4b6-xxx-9471-dxxxx37305c' \\<\/span>\r\n<span style=\"font-weight: 400;\">--header 'Content-Type: application\/json' \\<\/span>\r\n<span style=\"font-weight: 400;\">--header 'Authorization: Bearer eyJhbGciOiJIUzI1NixxxxxxxkpXVCJ9.eyJhxxxxxx5ODk0NWYxLTRjMmUtNTc5NC1iMGJkLWUxZjUwYzY3ODVkZiJ9.RQQAw-jKwbKWxwwP1xxxxxxrzuGF9oOqz77aRw' \\<\/span>\r\n<span style=\"font-weight: 400;\">--header 'Cookie: filetoken=cc7c5f79-xxxx-xxx-8c6b-a9xxxx26113' \\<\/span>\r\n<span style=\"font-weight: 400;\">--data-raw '{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\"message\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"type\": \"text\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"val\": \"Some description of the image\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"attachments\": [<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"url\": \"https:\/\/user-images.gxxxrcontent.com\/4432322\/14xxx568-dbxxx6c9-xxxx-xxx-b104-a6xxx24890.png\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0},<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\"from\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"id\": \"10xxx0601\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"userInfo\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"firstName\": \"first name\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"lastName\": \"last name\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"email\": \"example@abc.com\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"user_data\": {}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">}'<\/span>\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">For parameter descriptions, refer to the <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/channel-enablement\/adding-webhook-channel\/#Request_Parameters\"><span style=\"font-weight: 400;\">request parameters<\/span><\/a><span style=\"font-weight: 400;\"> table.<\/span><\/p>\n<h4><b>Type 2: <\/b><b>\u00a0Using fileId obtained from <\/b><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/upload-file-api\/\"><b>file upload API<\/b><\/a><\/h4>\n<p><span style=\"font-weight: 400;\">You can upload a file using the <\/span><b>fileId <\/b><span style=\"font-weight: 400;\">obtained from file upload API. <\/span><span style=\"font-weight: 400;\">The following example uses a webhook instance when multiple webhook channels are configured:<\/span><\/p>\n<pre>curl -X POST\r\n'https:\/\/bots.kore.ai\/chatbot\/v2\/webhook\/st-4b8ee63f-0bad-xxxx-xxx-a8c4xxxxx086\/xxxInstance\/ivrInst-c86xxxx54-xxxx-xxxx-9471-dfxxxx37305c' \\\r\n--header 'Authorization: Bearer {{YOUR_JWT_ACCESS_TOKEN}}' \\\r\n--header 'Content-Type: application\/json' \\\r\n--data-raw '{\r\n    \"message\": {\r\n        \"type\": \"text\",\r\n        \"val\": \"User utterance\",\r\n        \"attachments\": [\r\n            {\r\n                \"fileName\": \"My image file\",\r\n                \"fileType\": \"image\",\r\n                \"fileId\": \"650c3XXXXXXbXXc31\"\r\n            }\r\n        ]\r\n    },\r\n    \"from\": {\r\n        \"id\": \"103XXXXX601\",\r\n        \"userInfo\": {\r\n        \"userInfo\": {\r\n     \t\t \"firstName\": \"&lt;first-name(optional)&gt;\",\r\n      \t \"lastName\": \"&lt;second-name(optional)&gt;\",\r\n      \t \"email\": \"&lt;email@domain.com(optional)&gt;\"\r\n             \"user_data\": {}\r\n        }\r\n    }\r\n}'\r\n\r\n<\/pre>\n<p><span style=\"font-weight: 400;\">For parameter descriptions, refer to the <\/span><a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/channel-enablement\/adding-webhook-channel\/#Request_Parameters\"><span style=\"font-weight: 400;\">request parameters<\/span><\/a><span style=\"font-weight: 400;\"> table.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Option_2_Upload_Files_to_Koreai_XO_Platform\">Option 2: Upload Files to Kore.ai XO Platform<\/span><\/h3>\n<p>You can upload files directly to the Kore.ai XO Platform, capture the \u2018file id\u2019 provided by the platform, and share it with the bot during the conversation. This option is supported only when the Webhook v2.0 is used.<\/p>\n<p>Use the following API to upload your file to the platform. These APIs do not require any scopes and are accessible using any of the valid apps present in the bot\/account.<\/p>\n<pre>Request\r\n<span style=\"font-weight: 400;\">URL: <\/span><span style=\"font-weight: 400;\">https:\/\/{{host}}\/api\/public\/uploadfile<\/span><span style=\"font-weight: 400;\">\u00a0<\/span>\r\n<span style=\"font-weight: 400;\">   Method: POST<\/span>\r\n<span style=\"font-weight: 400;\">   Body:<\/span>\r\n<span style=\"font-weight: 400;\">     {<\/span>\r\n<span style=\"font-weight: 400;\">        File:,<\/span>\r\n<span style=\"font-weight: 400;\">        fileContext :,<\/span>\r\n<span style=\"font-weight: 400;\">        fileExtension : ,<\/span>\r\n<span style=\"font-weight: 400;\">        Filename:<\/span>\r\n<span style=\"font-weight: 400;\">   }<\/span>\r\nResponse\r\n          Response: {\r\n                        fileId:\r\n                        hash: \r\n  }\r\n<\/pre>\n<p>You can use the following API to upload file in chunks<\/p>\n<p><strong>Token API<\/strong><\/p>\n<pre>URL: \/api\/attachments\/:streamId\/:channelType\/token\r\n     Method: POST\r\n     Headers: {\r\n                 authorization:bearer jwttoken\r\n          }\r\n     Body:{\r\n    }\r\n<\/pre>\n<p><strong>Chunk Upload API<\/strong><\/p>\n<pre>URL: \/api\/attachments\/:streamId\/:channelType\/token\/:token\/chunk\r\nMethod: POST\r\nHeaders: {\r\n          authorization:bearer jwttoken\r\n       }\r\n      Body:{\r\n              chunk:\u201d\u201d,\r\n              chunkNo:2\r\n     }\r\n<\/pre>\n<p><strong>Commit API<\/strong><\/p>\n<pre>URL: \/api\/attachments\/:streamId\/:channelType\/token\/:token\/chunk\r\nMethod: PUT\r\nHeaders: {\r\n            authorization:bearer jwttoken\r\n        }\r\n     Body:{\r\n             fileContext:\u201d\u201d,\r\n             filename:\u201d\u201d,\r\n             totalChunks:\u201d\u201d,\r\n             fileExtension:\u201d\u201d\r\n       }\r\n<\/pre>\n<p><strong>Note<\/strong>: You can also use the filename or fileID to upload a file. For example, use this syntax to upload a file with name and ID: <code>{ \"fileName\": \"Kore_ai_Logo%405x.png\", \"fileType\":\"image\", \"fileId\": \"6163e17bf60e0a7e4799f423\" }<\/code>.<\/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=\"Handle_Digital_Forms\">Handle Digital Forms<\/span><\/h2>\n<p>If your bot has a form that needs user input, the synchronous WebHook channel gets the complete form definition in the response, and you need to send the <em>formData<\/em> in the request when interacting with the bot.<\/p>\n<h4>Sample Response<\/h4>\n<pre>{\r\n    \"text\": [],\r\n    \"form\": {\r\n        \"formDef\": { Formdef },\r\n        \"formInitialization\": { FormInitialization } \/\/if any\r\n    }\r\n    ..other params if any\r\n}<\/pre>\n<p><strong>FormDef<\/strong><br \/>\n(This is the complete Form definition which is used to render the Form)<\/p>\n<pre>{\r\n  \"_id\": \"\",\r\n  \"refId\": \"\",\r\n  \"streamId\": \"st-####a#d-##fd-#b##-acab-b#f#f######\",\r\n  \"branding\": { \r\n     \"properties\": []\r\n    },\r\n  \"components\": [\r\n    {\r\n     \"_id\": \"fct-#f#e###d-d#b#-###a-#a##-######f###b\",\r\n     \"refId\": \"#####f##-###c-###b-##a#-da########1d\",\r\n     \"metaData\": {\r\n         \"type\": \"textField\",\r\n         \"key\": \"textField\",\r\n         \"displayName\": \"Text Field\",\r\n         \"name\": \"TextField0\",\r\n         \"placeholder\": \"Provide your input\",\r\n         \"toolTip\": \"\",\r\n         \"isVisible\": true,\r\n         \"required\": false,\r\n         \"validations\": {\r\n            \"validationType\": \"simple\"\r\n            },\r\n         \"validateOn\": \"onBlur\"\r\n      },\r\n     \"name\": \"TextField0\",\r\n     \"type\": \"textField\"\r\n  },\r\n  {\r\n    \"_id\": \"fct-#f#e###d-d#b#-###a-#a##-######f###b\",\r\n    \"refId\": \"#####f##-###c-###b-##a#-da########1d\",\r\n    \"metaData\": {\r\n       \"type\": \"textField\",\r\n       \"key\": \"textField\",\r\n       \"displayName\": \"Text Field\",\r\n       \"name\": \"TextField1\",\r\n       \"placeholder\": \"Provide your input\",\r\n       \"toolTip\": \"\",\r\n       \"isVisible\": true,\r\n       \"required\": false,\r\n       \"validations\": {\r\n          \"validationType\": \"simple\"\r\n         },\r\n       \"validateOn\": \"onBlur\"\r\n      },\r\n      \"name\": \"TextField1\",\r\n      \"type\": \"textField\"\r\n    },\r\n   {\r\n     \"_id\": \"fct-#f#e###d-d#b#-###a-#a##-######f###b\", \r\n     \"refId\": \"#####f##-###c-###b-##a#-da########1d\",\r\n     \"metaData\": {\r\n        \"key\": \"button\",\r\n        \"type\": \"button\",\r\n        \"displayName\": \"Submit\",\r\n        \"name\": \"Submit\",\r\n        \"buttonAction\": \"submit\",\r\n        \"isVisible\": true,\r\n        \"buttonStyle\": \"primary\",\r\n        \"sourceUrl\": \"\"\r\n       },\r\n     \"name\": \"Submit\",\r\n     \"type\": \"button\"\r\n     }\r\n    ],\r\n   \"description\": \"regular\",\r\n   \"displayName\": \"Form 1\",\r\n   \"name\": \"firstForm\",\r\n   \"type\": \"regular\", \r\n   (... few other fields)\r\n}<\/pre>\n<p><strong>FormInitialization<\/strong><br \/>\n(This must be used for pre-filling Forms)<\/p>\n<pre>{\r\n       \"valueMap\": {\r\n       \"TextField0\": \"input1\",\r\n       \"TextField1\": \"input2\"\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<h4>Sample Request<\/h4>\n<pre>{\r\n    \"session\": {\r\n        \"new\": false\r\n    },\r\n    \"message\": {\r\n        \"formData\": {\r\n            \"formId\": \"frm-2b2f1ae4-9a3b-5f22-8940-b6827710940f\",\r\n            \"data\": [\r\n                {\r\n                    \"componentId\": \"fct-9f7e487d-d4b8-542a-9a77-7806819f141b\",\r\n                    \"input\": \"input1\"\r\n                },\r\n                {\r\n                    \"componentId\": \"fct-7aae4eae-2ce7-5d1b-8db1-bb5cfadc3342\",\r\n                    \"input\": \"input2\"\r\n                }\r\n            ],\r\n            \"meta\": {}\r\n        }\r\n    },\r\n    \"from\": {\r\n        \"id\": \"\"\r\n    }\r\n    ..others params if any\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><span class=\"ez-toc-section\" id=\"Error_Scenarios_in_Webhook_v2_Responses\">Error Scenarios in Webhook v2 Responses<\/span><\/h2>\n<p>The following is the failure response for 401 Error:<\/p>\n<pre>{\t\r\n  \"errors\": [\r\n    {\r\n      \"msg\": \"Invalid Access token\",\r\n      \"code\": 401\r\n    }\r\n  ],\r\n  \"_v\": \"v2\", \/\/versionId\r\n  \"_t\": \"RTM-TRACE-9JOHE3ALB\" \/\/traceId\r\n}\r\n<\/pre>\n<p>The following is the failure response for 429 Error (Rate Limit)<\/p>\n<pre>{\r\n  \"errors\": [\r\n    {\r\n      \"msg\": \"Too Many requests\",\r\n      \"code\": 429\r\n    }\r\n  ],\r\n  \"_v\": \"v2\", \/\/versionId\r\n  \"_t\": \"RTM-TRACE-9JOHE3ALB\" \/\/traceId\r\n}\r\n<\/pre>\n<p>The following is the failure response for 504 Error:<\/p>\n<pre>{\r\n  \"errors\": [\r\n    {\r\n      \"msg\": \"The request has been timed-out\",\r\n      \"code\": 504\r\n    }\r\n  ],\r\n  \"_v\": \"v2\", \/\/versionId\r\n  \"_t\": \"RTM-TRACE-9JOHE3ALB\" \/\/traceId\r\n}\r\n<\/pre>\n<p>The following is the failure response for 400 Error:<\/p>\n<pre>{\r\n  \"errors\": [\r\n    {\r\n      \"msg\": \"Invalid Request Payload\",\r\n      \"code\": 400\r\n    }\r\n  ],\r\n  \"_v\": \"v2\", \/\/versionId\r\n  \"_t\": \"RTM-TRACE-9JOHE3ALB\" \/\/traceId\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\"><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"Webhook channel provides a generic integration framework to connect your virtual assistant with any external communication systems. Kore.ai XO Platform provides standard request and response APIs to send and receive messages in text format. The end user\u2019s input through a voice, keypad, or any other means must be converted to plain text before sending to...","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-18046","post","type-post","status-publish","format-standard","hentry","category-channel-enablement"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18046","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=18046"}],"version-history":[{"count":86,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18046\/revisions"}],"predecessor-version":[{"id":61357,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18046\/revisions\/61357"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=18046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=18046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=18046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}