Install the widget

Get started with embedding hotglue

When you first enter hotglue, an environment will automatically be created for you, and the embed instructions will be displayed as shown below.


hotglue environment dashboard with embed instructions

Installation (React)

Install the @hotglue/widget package

If your project is built in React, you can install the @hotglue/widget package.

using npm

  npm install @hotglue/widget

or using yarn

  yarn add @hotglue/widget

Launch the widget

First you must include the HotglueConfig provider as a higher order component in your React app. For example, in index.js:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import HotglueConfig from '@hotglue/widget';

      apiKey: 'your-public-environment-api-key',
      envId: 'your-env-id'
    <App />

Now you can launch the widget using the useHotglue hook:

import { useHotglue } from '@hotglue/widget';

const App = (props) => {
  const { openWidget } = useHotglue();

  return <div>
    <button onClick={() => openWidget("test-user")}>Open widget</button>

export default App;

You can also use the Connections component if you want to use the widget inline rather than in a modal.

Installation (Vanilla JavaScript)

Include the widgetv2 script

The first step of embedding hotglue is to add the widget to your web app. Simply copy the code generated from the hotglue environment dashboard into your HTML head tag.

The embed code follows the following format:

<script src=""></script>
        "api_key": "YOUR-API-KEY",
        "env_id": "YOUR-ENV-ID"

If you'd like to use async script loading and are having errors with the HotGlue.mount function, you can use the following sample:

    var head = document.getElementsByTagName("head")[0];
    var script = document.createElement("script");

    script.type = "text/javascript";
    script.async = true;
    script.onload = function () {
        "api_key": "YOUR-API-KEY",
        "env_id": "YOUR-ENV-ID"
    script.src = "";

Launch the widget

Now that the hotglue widget is installed in your web app, open the widget by calling<tenant id>)

    function launchHG() {
        // change "test-user-id" to the id of the current user'test-user-id', {});
<button onclick="launchHG()">
    <span>Open hotglue widget</span>