Skip to content

Livechat handover

Hand over conversations from the Unless AI assistant to your existing livechat system. When a user requests human support, the AI component triggers a custom JavaScript command that opens your livechat, passes the conversation transcript, and closes the AI chat.

  1. The AI assistant detects the user wants to speak with a human (based on the Guidance rules you configure).
  2. A custom JavaScript command runs in the browser.
  3. That script opens your livechat widget, sends the transcript, and closes the Unless AI component.

In the Unless dashboard, create a new AI Skill for the livechat handover. Select Custom JavaScript as the command type.

Use the Guidance tab on the skill to define when the livechat option should be presented to the user — for example, when they explicitly ask for a human agent or when the AI cannot resolve their question.

Your custom JavaScript needs to do three things:

  1. Open the livechat widget.
  2. Send the transcript to the livechat so the human agent has full context. Use Txt.getChatTranscript() to retrieve it.
  3. Close the Unless AI component with Txt.closeChat().

Most livechat tools show a floating launcher button by default. Since Unless already provides the entry point, you should hide it. Depending on your provider you can:

  • Disable the launcher in the livechat tool’s own settings.
  • Use the provider’s JavaScript API to hide it on load.
  • Add custom CSS to hide it, for example:
/* Example: hide a livechat launcher by class name */
.livechat-launcher {
display: none !important;
}

Below is a complete handover script for Zendesk Messaging. Adapt it to match your Zendesk configuration.

// Start a new Zendesk conversation with the AI transcript
zE("messenger:ui", "newConversation", {
displayName: "Support Chat",
metadata: {
source: "unless"
},
message: {
content: {
type: "text",
text: Txt.getChatTranscript()
}
}
});
// Tag the conversation so agents know it came from the AI assistant
window.zE?.("messenger:set", "conversationTags", ["unless"]);
// Show and open the Zendesk messenger
window.zE?.("messenger", "show");
window.zE?.("messenger", "open");
// Close the Unless AI component
Txt.closeChat();

To prevent the default Zendesk button from appearing alongside Unless, add this snippet when you load the Zendesk widget:

zE('messenger', 'hide');
MethodDescription
Txt.getChatTranscript()Returns the full conversation transcript as a formatted string.
Txt.closeChat()Closes the Unless AI chat component.
  • Test the handover flow end to end. Verify that the transcript arrives in the livechat and that the agent can read it.
  • Set conversation tags or metadata so your support team can identify handovers from the AI assistant and route them appropriately.
  • Keep the livechat script tag on the page even though the launcher is hidden — the widget still needs to be loaded for the JavaScript API to work.