1. Home
  2. Kore.ai Conversational Platform
  3. Bot Builder Tool
  4. Adding Channels to your Bot
  5. Adding Webhook as a channel

Adding Webhook as a channel

Webhook channel provides a generic webhook integration to connect your bot with any external communication systems. Kore.ai platform provides standard request and response APIs to be used to send and receive text messages. End user’s input through a voice, keypad or any other means needs to be converted to plain text before it is sent to Kore.ai platform using the request API.

To enable Webhook channel for your Kore.ai bot, you need to:
  1. Associate App--To enable Webhook channel for your Kore.ai bot, you need to associate the channel with either an existing app in your Kore.ai account or create a new app.
  2. Select Integration Mode- You will need to enable an integration mode that is supported by the channel based on your business requirement. You can copy the Webhook URL from the configurations tab of the channel.
  3. Review Payload Formats- Review Payload formats for verifying the integration.
To add Webhook as a channel:
  1. In the Bots section of the Bot Builder, click the Bot that you want to add the Webhook channel to.
  2. On the Channels tab, click the Webhook icon. The Webhook page gets displayed.
  3. Navigate to Configurations tab of this page and associate this channel with an app. You may select any of the existing Apps available in your Kore.ai account or create a new app.
  4. Generate JWT token using the credentials of the selected app and use this token for secure communication with Kore.ai platform. Also, “sub” should be passed in the payload for generating JWT.
  5. Webhook channel supports both synchronous and asynchronous modes and depending on your business needs, you can enable one of these modes in the Configurations tab.
    • Synchronous mode delivers full response directly to the incoming requests.
    • Asynchronous mode defines the POST_URL of your external system and Access Token to be used for delivering partial or full responses. When hit, the WebHook URL will receive an empty message with 200 status code, the response message will be sent to the POST_URL defined.
  6. Webhook URL required to enable integration can be viewed in the Configurations tab. The headers Authorization and Content-Type are needed to make a POST call to Webhook URL.
  7. You will need to review Payload formats for verifying the integration. Following are code snippets of the payload formats:

Incoming Webhook Payload

Below is the Webhook payload format to post messages to Kore.ai Bots Platform.

The “session” will decide how the message is handled. If set to “true”, the task will be discarded and the user message will be treated as a new request of intent identification. If set to “false”, it will be taken as a part of the existing task.

payload : {
             "session" :{             
                        "new" : true
                        },
            "message":{
                         "text" : "Hi",
                         "attachments" : []
                        },
             "from" :{
                        "id": <unique-id-of-sender(mandatory)>,
                        "userInfo" :{
                                     "firstName" : <first-name(optional)>,
                                     "lastName" : <second-name(optional)>,
                                     "email" : <email(optional)>
                                    }
                        },
            "to" :{
                        "id": <unique-id-of-recipient(mandatory)>,
                        "groupInfo" :{                           
                                      "id" : ,
                                      "name": <group-name(optional)>
                                    }
                    }
        }                   

Synchronous Response

{
    "text' : "message"
}

Asynchronous Response to POST_URL

{
"text" : "message",
"to" : "to_id",
"from" : "from_id"
}
Was this article helpful to you? Yes No 10