The hotglue widget is a white-labeled component that allows your users to integrate instantly, without leaving your app. You can embed the widget using a few lines of Javascript or React.
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.
Option 1 - HotGlue.link()Now that the hotglue widget is installed in your web app, open the widget by calling HotGlue.link(<tenant id>, <flow id>, <source>, <preloaded>, <options>). In the example below, we also use options to hide the back button and add a listener to close the widget once the source is successfully linked.
<script> function launchHGSource() { // Set the tenantId, flowId, and sourceId variables below HotGlue.link(tenantId, flowId, sourceId, false, { hideBackButtons: true, listener: { onSourceLinked: () => { HotGlue.close(); } } }) }</script><button onclick="launchHGSource()"> <span>Open specific source</span></button>
Option 2 - HotGlue.open()Alternatively, you can open the widget “flows” menu by calling HotGlue.open(<tenant id>)
<script> function launchHG() { // change "tenant-id" to the id of the current user HotGlue.open('test-user-id', {}); }</script><button onclick="launchHG()"> <span>Open hotglue widget</span></button>