IntegrationsVuepress

Add Embedded Chat to VuePress

Integrate Inkeep's embedded chat into your VuePress documentation for seamless user interaction.

What is VuePress

VuePress a markdown-centered static site generator.

Get an API key

Follow these steps to create an API key for your web integration.

Load the script files

  1. Navigate to the .vuepress directory
  2. Add the below scripts to the config.js file:
config.js
export default {
  head: [
    [
      "script",
      {
        src: "https://cdn.jsdelivr.net/npm/@inkeep/cxkit-js@0.5/dist/embed.js",
        type: "module",
        defer: true,
        onLoad: "initializeInkeep()",
      },
    ],
    ["script", { src: "js/addInkeep.js", type: "module", defer: true }],
  ],
};

Create the addInkeep.js script

Create an addInkeep.js file in your public/js folder.

touch public/js/addInkeep.js

Create container for embedded chat

To create a container for the embedded chat component, navigate to your desired page and add the following code:

<ClientOnly>
  <div id="inkeepEmbeddedChat"></div>
</ClientOnly>

Configure the component

Next, configure the Inkeep widget:

addInkeep.js
const initializeInkeep = () => {
  const addInkeepWidget = () => {
    const embeddedContainer = document.querySelector("#inkeepEmbeddedChat");
 
    if (!embeddedContainer) return;
 
    const inkeepWidget = Inkeep.EmbeddedChat("#inkeepEmbeddedChat", {
      baseSettings: {
        apiKey: "INKEEP_API_KEY", // required
        primaryBrandColor: "#26D6FF",
        organizationDisplayName: "Inkeep",
        colorMode: {
          sync: {
            target: document.documentElement,
            attributes: ["data-md-color-scheme"],
            isDarkMode: (attributes) => {
              const currentTheme = attributes["data-md-color-scheme"];
              return currentTheme === "dracula" || currentTheme === "dark";
            },
          },
        },
      },
    });
  };
 
  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", addInkeepWidget);
 
    return;
  }
 
  addInkeepWidget();
};

For a full list of customizations, check out the Embedded Chat documentation.

On this page