You can use the WebHook node to subscribe to a message and to WebHook events that capture real-time data from real-time events and show them to the user. You can use the WebHook node for server-side validation, execute business logic, or make backend server API calls. Also, you can use the Kore.ai SDK Tool BotKit to add event handlers, control the messages and WebHook events as required by connecting the WebHook node to a script node to process the response.
Create and Register an App
To get access to WebHook events and use WebHook nodes in your dialog task, you need to subscribe and configure an app in the Deploy > Integrations tab of your Virtual Assistant. For more information, refer to SDK Configuration. Let us use the example of an Agent Transfer app.
- Select the Deploy tab from the top menu
- On the left menu, click Integrations > Agent Transfer.
- On the Agent Transfer page, click Add next to the App Name drop-down list.
- On the Create Client App window, enter the app name in the Name field. For example, SDK App.
- Click Next.
- The Client ID and Client Secret are generated along with the App Created Successfully message.
- Click Done.
- In the Callback URL field, enter the URL for your application that you want Kore.ai to push data to. For example, https://koremessenger.com/postURL.
Note: The registration app you create is based on the Callback URL applicable to all tasks for the bot. While each task can have unique SDK configurations, the Callback URL is the same. Create separate bots for separate application Callback URLs for live agent transfers.
- Under the PII Data section, define how sensitive information should be handled. If there is a need to share unmasked data when an agent session is in progress, even when PII redaction is enabled, select the Do not mask and send original data to Agent BotKit. Else, go with the default setting of Mask and send sensitive data to Agent BotKit.
- Under the Access Using a Connector section, indicate if your URL is behind a firewall and a Connector has to be used.
- Click Save. The Successfully subscribed message is displayed.
Add the Node
Webhook Nodes can only be added as part of a Bot Action node. Therefore, before you can add a Webhook Node, you need to add a Bot Action node.
|Note: Post v9.0 of the Platform, the Webhook node is categorized under the Bot Action node. For details on the Bot Action node.|
Keeping this in mind, the setup a Webhook node in a dialog task involves the following steps:
- Open the dialog task to add the Webhook node.
- Create and/or expand a Bot Action node.
- Add a Webhook node in the designated place. For steps related to adding nodes, refer here.
- The Webhook window is displayed with the Component Properties tab selected by default.
- To connect a Webhook node to a node outside of its containing Bot Action node, please read our article about the Bot Action Node.
Configure the Node
To configure the Component Properties tab, please follow the steps below:
- On the Component Properties tab, under the General Settings section, enter the Name and Display Name of your Webhook node.
- In the Variable Namespaces section, associate the variable namespaces to execute this node and its transitions. This option is visible only when the Variable Namespace is enabled for the VA. You can go with the task level settings or customize it for this node. For more information, refer to Managing Namespace.
Use the Instance Properties to define any user tags that you want to set for the Webhook node.
|Note: The settings in the Instance Properties tab are specific to the current dialog task and do not reflect in other dialog tasks that use this node.|
- On the Webhook node properties panel, click the Instance Properties tab.
- Under the Custom Tags section, add tags to build custom profiles of your VA’s conversations. Click here for more.
Since they are contained within Bot Action nodes, Webhook nodes cannot be connected on their own to any other nodes outside the Bot Action node to which they belong. Connections can only be made with nodes contained within the same Bot Action node.
From the node’s Connection Properties tab, you can configure the following:
- Webhook Node Connections: The node within the Bot Action to execute next, after the Webhook node runs.
- Bot Action Connections, where you can update the node to trigger after the Bot Action group is executed. Updates made here will apply to all nodes within the same Bot Action.
For both connection types you can write conditional statements based on the values of any Entity or Context Objects in the dialog task, or you can use Intents for transitions.
Note: The conditions configured here are applicable only for this instance and will not affect this node when being used in any other dialog.
To set up node connection conditions, please follow the steps outlined in Adding IF-Else Conditions to Node Connections.