This example uses buildWithDomainCredentials
to build the Chat SDK, as explained on the main page.
It also uses the NL (Natural Language) escalation 2 adapter included in the SDK from version 1.31.0.
This example shows:
For more information about each adapter, see:
Make sure that you respect the order of the elements in the adapters array: because of the callback adapter system, to avoid any conflict, the first element of the adapter array must be the escalation adapter, and the next one the external chat adapter. Do not alter the order, or the subscriptions may not execute the callback as expected. This can cause the Chat app to malfunction or show unexpected behavior.
This adapter requires certain intents and the escalation dialog. For more information, see Default contents for Agent Chat escalation(This link redirects you to the Help Center).
This example uses the default configuration. You only need to set the required parameters:
q
in the urlThis example uses both adapters from the internal code.
<!DOCTYPE html>
<html>
<head>
<title>Agent Chat Demo</title>
<meta charset="utf-8">
</head>
<body>
<script>
window.buildUI = function () {
var authorization = {
domainKey:'<example_domain_key>',
inbentaKey:'<example_api_key>'
};
SDKHCAdapter.configure({
apiKey: '<chat_api_key>', // former "appId"
region: '<chat_app_region>',
room: function () {
return SDKHCAdapter.helpers.getQueryParameterValue('q');
},
});
var config = {
launcher: {
title: 'Agent Chat Demo'
},
adapters: [
SDKNLEscalation2(SDKHCAdapter.checkEscalationConditions),
SDKHCAdapter.build(),
],
};
InbentaChatbotSDK.buildWithDomainCredentials(authorization, config);
};
</script>
<script src="https://sdk.inbenta.io/chatbot/1/inbenta-chatbot-sdk.js" onload="buildUI()"></script>
</body>
</html>
The appId
parameter is DEPRECATED in favor of apiKey
, for consistency with Inbenta terminology. If you use appId
, Inbenta recommends that you update your configuration.