To access webhooks and messages in Dialog tasks, you need to subscribe to an app for your bot. All messages from the bot and user are sent to the SDK as message events. When a Webhook node is defined in a Dialog task, the webhook event is sent to the SDK at runtime. You must install, host, and configure the Kore.ai SDK in your network to allow communications between the bot event messages and webhooks, and your application.
To create an app
- Hover over the side-navigation panel of the bot, and click Apps & Agents. The BotKit SDK tab opens by default.
- On the BotKit SDK page, click the Add button next to the App Name drop-down list. The Create App dialog opens.
- In the App Name field, enter the name of the app registration, for example, SDK App, and then click Next.
- The Client ID and Client Secret are generated along with the App Created Successfully message.
- Click Done. The following fields appear.
- In the Callback URL field displayed, enter the URL for your application that you want Kore.ai to push data to, for example, https://koremessenger.com/postURL.
- In the Events section, select one or more of:
- OnMessage – Triggers an event when a message from a user is received.
- OnHookNode – Triggers an event when a WebHook node is encountered in the Dialog task flow.
- onEvent – Triggers an event every time a Dialog or FAQ is finished.
- onAlert – Triggers an event when the user receives an alert message.
- onVariableUpdate – Triggers an event when the bot is published
- Click Create Credentials.
The new app registration along with credentials is displayed in the SDK Configuration section.