IntegrationsWebflow

Add Custom Modal Trigger to Webflow

Add Inkeep's custom modal trigger to your Webflow site.

What is Webflow

Webflow is a visual web development platform that enables users to design, build, and launch websites without the need for coding.

Get an API key

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

Connect the script

  1. Navigate to Site settings (not the designer)
  2. Open the Custom code tab
  3. Add the below to the Head code section
<script
  id="inkeep-script"
  type="module"
  src="https://cdn.jsdelivr.net/npm/@inkeep/cxkit-js@0.5/dist/embed.js"
  defer
></script>

Create a trigger

You need to create a trigger in your application with ID - inkeepButton. This can be done using Webflow's built-in designer.

Example:

Initialize the widget

Click on the Footer code section and add the below script.

<script type="text/javascript" defer>
  const inkeepButton = document.getElementById("inkeepButton");
  const inkeepDiv = document.createElement("div");
 
  inkeepDiv.id = "inkeepModal";
  inkeepDiv.style.position = "absolute";
  document.body.appendChild(inkeepDiv);
 
  // configure and initialize the widget
  const config = {
    baseSettings: {
      apiKey: "INKEEP_API_KEY", // required
      primaryBrandColor: "#26D6FF", // your brand color, widget color scheme is derived from this
      organizationDisplayName: "Inkeep",
      // ...optional settings
    },
    searchSettings: {
      // optional settings
    },
    aiChatSettings: {
      // optional settings
      aiAssistantAvatar: "/img/logo.svg", // use your own AI assistant avatar
      exampleQuestions: [
        "Example question 1?",
        "Example question 2?",
        "Example question 3?",
      ],
    },
    modalSettings: {
      onOpenChange: handleOpenChange,
      // optional settings
    },
  };
 
  // Initialize the widget using the `Inkeep.ModalSearchAndChat()` function.
  const inkeepWidget = Inkeep.ModalSearchAndChat(config);
 
  function handleOpenChange(newOpen) {
    inkeepWidget.update({ modalSettings: { isOpen: newOpen } });
  }
 
  // Add click event listener to custom trigger
  document.getElementById("custom-trigger").addEventListener("click", () => {
    inkeepWidget.update({ modalSettings: { isOpen: true } });
  });
</script>

For a full list of customizations, check out the Custom Modal Trigger documentation.

On this page