DocumentationIntegrate assistant

Integrate assistant

Steps to integrate the chat widget into your website by adding a simple code snippet.

Introduction

Follow these steps to integrate the Refly chat widget into your website. By adding a simple code snippet, you can enable the chat widget on any page you choose.

Installation Steps

Go to Assistant > Assistant Settings > Integrate in the Refly admin dashboard.

Copy Your Code Snippet

In the integration settings, you will find a unique code snippet for your assistant. Copy this code snippet to your clipboard.

Locate the Closing </body> Tag

Navigate to the HTML file of the webpage where you want the Refly chat widget to appear. Locate the closing </body> tag.

Paste the Code Snippet

Paste the copied code snippet right before the closing </body> tag. This ensures that the chat widget is loaded and displayed correctly on your page.

Save Your Changes

Save the changes to your HTML file and upload it to your server if necessary.

Test the Integration

Open the webpage where you added the chat widget to verify that it appears correctly. The widget should be visible and functional.

Example Code Snippet

<!-- Refly chat widget -->
<div id="refly-chat" data-aid="YOUR-ASSISTANT-ID"></div>
<script type="text/javascript">
    (function (d, s) {
        window.onload = function () {
            var r = d.createElement(s);
            r.src = 'https://chat.refly.co/widget.js';
            r.async = true;
            d.body.appendChild(r);
        };
    }(document, 'script'));
</script>

Use the code snippet provided in your admin dashboard as it already has the correct data-aid.