Embedded action links in AI responses for live agent escalation, WalkMe flows, and custom client-side actions
The widget supports custom protocol links in markdown content. When an AI response includes a link with a non-standard protocol (anything other than http:, https:, mailto:, tel:), the widget:
linkClick event with parsed dataAI responses can include markdown links with custom protocols:
| Markdown Syntax | Parsed Result |
|---|---|
| [Speak to Agent](action:escalate-to-agent) | protocol: "action:", params: { value: "escalate-to-agent" } |
| [Contact Support](livechat:department=billing&priority=high) | protocol: "livechat:", params: { department: "billing", priority: "high" } |
| [Show tutorial](walkme:flowId=12345) | protocol: "walkme:", params: { flowId: "12345" } |
protocol:key=value&key2=value2 → { key: "value", key2: "value2" }protocol:value → { value: "value" }const widget = window.NexusChatWidget.init({
experienceId: "your-experience-id",
apiUrl: "undefined",
advanced: {
customProtocolHandlers: {
// Handle action: protocol for generic actions
"action:": (params, event) => {
if (params.value === "escalate-to-agent") {
// Trigger live agent handover
openLiveAgentChat({
sessionId: event.sessionId,
source: "ai-response"
});
}
},
// Handle livechat: protocol with parameters
"livechat:": (params, event) => {
openLiveAgentChat({
department: params.department,
priority: params.priority || "normal",
sessionId: event.sessionId
});
},
// Handle walkme: protocol for tutorials
"walkme:": (params, event) => {
if (window.WalkMeAPI && params.flowId) {
window.WalkMeAPI.startFlowById(parseInt(params.flowId));
}
}
}
}
});
// Track all link clicks for analytics
widget.on("linkClick", (data) => {
console.log("Link clicked:", data);
analytics.track("link_click", {
protocol: data.protocol,
action: data.params.value,
linkText: data.text
});
});Click the action links in the widget to see events appear here:
Events will appear here...