Integrate Mavenoid with Dynamic 365 Live Chat to connect users with live agents in Dynamics.
Contributor Access To Mavenoid: If you do not have contributor permissions, contact your Mavenoid representative.
Mavenoid Embed Script Access: The integration uses the External Script node in Mavenoid.
Use the External Script node to trigger the live chat to open when customers want to chat with an agent.
Copy the Dynamic's Live Chat Code:
Retrieve the JavaScript chat code. See Dynamic's guide Configure a chat widget for details.
Configure Dynamic's Opening Function:
After loading the Live Chat SDK, use startChat() to open the chat widget.
Pass context to Dynamics:
Pass user data and assistant context using the setContextProvider(contextProvider) method.
Close Mavenoid Assistant:
If using the Mavenoid Web Touchpoint, call mavenoid.push({ event: assistant-unmount })
to avoid widgets overlapping. The event listener lcw:startChat can be used to identify when the Dynamic's widget has been opened.
Add Dynamic's Code to External Script:
See External Scripts for Chat Handovers for detailed setup instructions.
externalScripts: {
async dynamicsHandover(input) {
var context = input.context; // Context of what happened in the assistant
window.addEventListener("lcw:ready", function handleLivechatReadyEvent() {
function contextProvider() {
return {
source: { value: "Mavenoid", isDisplayable: false }, // Set the source as "Mavenoid"
context: { value: context, isDisplayable: true },
};
}
function OpenChat() {
Microsoft.Omnichannel.LiveChatWidget.SDK.setContextProvider(
contextProvider
);
Microsoft.Omnichannel.LiveChatWidget.SDK.startChat();
}
OpenChat();
});
window.addEventListener(
"lcw:startChat",
function handleLivechatStartedEvent() {
window.mavenoid.push({ event: "troubleshooter-unmount" });
}
);
// Create a script element
var script = document.createElement("script");
// Set attributes for the script element
script.id = "Microsoft_Omnichannel_LCWidget";
script.src =
"{your_script_src}";
script.setAttribute("data-app-id", "{your_data_app_id}");
script.setAttribute("data-lcw-version", "{your_version}");
script.setAttribute("data-org-id", "{your_data_org_id}");
script.setAttribute("data-org-url", "{your_data_org_url}");
script.setAttribute("data-hide-chat-button", "true");
// Append the script element to the head of the document
document.head.appendChild(script);
return {
formData: [
{
id: "status",
value: {
type: "string",
value: "ok",
},
},
],
};
},
};