The purpose of this adapter is to check for the availability of agents, set the
agents_available variable so the automatic transitions are applied correctly and track the escalation information.
The adapter does the following actions:
escalationOffer. This intent is usually the start of the escalation dialog where the user gets asked if they want to speak with an agent. Its directCall attribute is
escalationOffer. While it processes the messages of the escalation dialog, the SDK checks if there are agents available in the background. It sets the
escalationStartaction is called. This is usually set as an intent callback. When an intent callback has a function name
escalationStart, it calls the chatbot action that the adapter is subscribed to. It does the following actions:
escalationStart. Usually the intent with this directCall is the one that starts the escalation process. This makes it possible to redirect from any intent with an
escalationStartaction to the escalation start intent.
escalateToAgent. This triggers the
escalateToAgentaction. The second chat adapter is subscribed to the
escalateToAgentactio. It retrieves the information sent by the callback and initiates the live chat.
onSetExternalInfo. Inbenta HyperChat triggers
onSetExternalInfowhen escalation occurs. It uses this subscription to receive data from the chat system and track any information provided.
For more information about the required escalation dialog and intents, see Default Contents For Live Chat Escalation (This link redirects you to the Help Center).
This link contains the default intents to make the escalation process work out of the box. You can modify the dialog and intents to meet your desired purposes. Some examples are:
Proceed at your own risk when you update the default dialog and intents. Test your desired functionality thoroughly before you deploy the solution into production.
You can find this adapter in the Inbenta Github adapters repository.
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 chatbot to malfunction or show unexpected behaviour.
This adapter is included in the Chatbot SDK to facilitate the steps to integrate Hyperchat and the escalation from version 1.31.0
To use an internal adapter, you must set the adapters array like this:
adapters: [ SDKNLEscalation2(checkAgents) ]
SDK at the beginning of the function name is what forces the SDK to use the internal adapter.
agents_available variable must exists in your instance, as this is where the system stores the detection of agents availability.
There are different ways you can perform the escalation, but by default, the adapter looks for the following two conditions in the intents:
escalationStart callback : When the system detects an intent with this callback function name, it expects the user to be redirected directly to the escalation. Your instance must contain an intent with the directCall
escalationStart, and the API then performs the automatic transition depending on the
escalationOffer directCall: This directCall must be in the parent node of the escalation dialog. It serves to check for agents and set the variable before asking if the user wants to chat with a human.
NLEscalation2 function creates the adapter. The entry parameters are the following:
checkAgentsfunction: This must be a function. It comes from the external chat adapter and checks if there are available Agents. If you use the code samples below, make sure to replace
checkAgentswith the appropriate function name from your chosen product.
const checkAgents = () => Promise.resolve(true);
Because most of the events are now tracked automatically in the API (TRACKING attribute), the adapter only does one tracking event. It triggers when the escalation is done and sends the required information to the API.