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.
How it works
Section titled “How it works”- The AI assistant detects the user wants to speak with a human (based on the Guidance rules you configure).
- A custom JavaScript command runs in the browser.
- That script opens your livechat widget, sends the transcript, and closes the Unless AI component.
1. Create a livechat skill
Section titled “1. Create a livechat skill”In the Unless dashboard, create a new AI Skill for the livechat handover. Select Custom JavaScript as the command type.
2. Configure guidance
Section titled “2. Configure guidance”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.
3. Write the handover script
Section titled “3. Write the handover script”Your custom JavaScript needs to do three things:
- Open the livechat widget.
- Send the transcript to the livechat so the human agent has full context. Use
Txt.getChatTranscript()to retrieve it. - Close the Unless AI component with
Txt.closeChat().
4. Hide the livechat floating button
Section titled “4. Hide the livechat floating button”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;}Example: Zendesk
Section titled “Example: Zendesk”Below is a complete handover script for Zendesk Messaging. Adapt it to match your Zendesk configuration.
// Start a new Zendesk conversation with the AI transcriptzE("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 assistantwindow.zE?.("messenger:set", "conversationTags", ["unless"]);
// Show and open the Zendesk messengerwindow.zE?.("messenger", "show");window.zE?.("messenger", "open");
// Close the Unless AI componentTxt.closeChat();Hiding the Zendesk launcher
Section titled “Hiding the Zendesk launcher”To prevent the default Zendesk button from appearing alongside Unless, add this snippet when you load the Zendesk widget:
zE('messenger', 'hide');API reference
Section titled “API reference”| Method | Description |
|---|---|
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.