Integrate Mavenoid with Kustomer Chat to connect users with live agents in Kustomer.
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 Kustomer Chat to open when the customer wants to chat with an agent in Kustomer.
Copy the Kustomer Chat Snippet:
Retrieve the Web Widget chat code. See Kustomer's guide Introduction to Kustomer Chat for details.
Configure Kustomer Chat Opening Function:
After loading the Kustomer chat SDK, use Kustomer.createConversation() to initiate a conversation in Kustomer chat.
Pass context to Kustomer
Pass user data and assistant context using the Kustomer.describeCustomer() and Kustomer.describeConversation()
functions.
Close Mavenoid Assistant on Kustomer Launch:
If using the Mavenoid Web Touchpoint, call mavenoid.push({ event: assistant-unmount })
to avoid widgets overlapping. The event listned onOpen can be used to identify when the Kustomer widget has been opened.
Add Kustomer Code to External Script:
See External Scripts for Chat Handovers for detailed setup instructions.
Here’s an example of what the external script might look like:
externalScripts: {
async openKustomerChat(input) {
var { email, context } = input;
window.addEventListener("kustomerLoaded", function () {
Kustomer.start({ hideHistory: true }, function () {
console.log("Kustomer Chat Widget Started!");
Kustomer.addListener("onOpen", function () {
console.log("Kustomer Chat Widget Opened!");
// Hide Mavenoid to Prevent Overlapping Widgets
mavenoid.push({
event: "assistant-unmount",
});
});
if (
Kustomer.isChatAvailable() &&
Kustomer.isChatAvailable().availability === "online"
) {
// Update custom attributes of the customer
Kustomer.describeCustomer({
attributes: {
emails: [email],
},
});
// Describes a conversation when a conversation is created
Kustomer.addListener("onConversationCreate", (res) => {
Kustomer.describeConversation({
conversationId: res.conversationId,
customAttributes: {
some_custom_attribute: context,
},
});
});
}
});
});
// Load Kustomer Chat SDK
var script = document.createElement("script");
script.src = "https://cdn.kustomerapp.com/chat-web/widget.js";
script.setAttribute("data-kustomer-api-key", "{your_kustomer_api_key}");
document.body.appendChild(script);
return {
formData: [
{
id: "result",
value: {
type: "string",
value: "ok",
},
},
],
};
},
}