Skip to Content
Support Hub
Integrations & ActionsConnect to Kustomer Web Widget Chat

Integrations & Actions

Connect to Kustomer Web Widget Chat

Integrate Mavenoid with Kustomer Chat to connect users with live agents in Kustomer.

Requirements

  • 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.

Configure the Integration

Use the External Script node to trigger the Kustomer Chat to open when the customer wants to chat with an agent in Kustomer.

  1. Copy the Kustomer Chat Snippet:
    Retrieve the Web Widget chat code. See Kustomer's guide Introduction to Kustomer Chat for details.

  2. Configure Kustomer Chat Opening Function:
    After loading the Kustomer chat SDK, use Kustomer.createConversation() to initiate a conversation in Kustomer chat.

  3. Pass context to Kustomer
    Pass user data and assistant context using the Kustomer.describeCustomer() and Kustomer.describeConversation()
    functions.

  4. 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.

  5. 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",
          },
        },
      ],
    };
  },
}

Need more help?

Ask a different questionIntegrations & Actions
Select a different product
© 2024 Mavenoid ABSitemap
Terms of servicePrivacy policyCookie policyData processing agreement