Legacy widget

Legacy widget

Deprecated

The legacy widget is deprecated and will not receive future updates. Use the Embed SDK for new deployments.

The legacy option shows a floating button that opens the agent in a popup. To use the legacy widget, add one of the code snippets below to the <head> of your page:

<head>
    <script type="text/javascript">
        window.RFCopilotConfig = {
            apiKey: '<< insert your API key here >>',
            userId: '<< set a user ID (email) based on current user context >>',
            theme: '<< "light" | "dark" >>',
            position: '<< "bottom-right" | "bottom-left" | "top-right" | "top-left" | undefined >>',
            widgetTriggerSelector: '<< insert any valid CSS selector here (optional) >>',
            agent: '<< set agent to show (optional) "qa" | "product-selection" >>',
            onLoad: () => {
                // Called when the agent widget is loaded and ready
            },
            onOpen: () => {
                // Called when the agent widget is opened
            },
            onClose: () => {
                // Called when the agent widget is closed
            }
        };
    </script>
    <script type="text/javascript" src="https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/latest/script.js" defer></script>
</head>

Option 2

<head>
    <script id="rfCopilotWidgetScript" type="text/javascript" src="https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/latest/script.js" defer></script>
    <script>
        rfCopilotWidgetScript.addEventListener('load', function () {
            window.RFCopilot({
                apiKey: '<< insert your API key here >>',
                userId: '<< set a user ID (email) based on current user context >>',
                theme: '<< "light" | "dark" >>',
                position: '<< "bottom-right" | "bottom-left" | "top-right" | "top-left" | undefined >>',
                widgetTriggerSelector: '<< insert any valid CSS selector here (optional) >>',
                agent: '<< set agent to show (optional) "qa" | "product-selection" >>',
                onLoad: () => {
                    // Called when the agent widget is loaded and ready
                },
                onOpen: () => {
                    // Called when the agent widget is opened
                },
                onClose: () => {
                    // Called when the agent widget is closed
                }
            });
        });
    </script>
</head>

Legacy widget position

Choose where the launcher icon appears: bottom-right, bottom-left, top-right, or top-left. If you don't set position, it defaults to bottom-right and users can drag it to any corner.

Legacy widget configuration

ParameterRequired?DefaultDescription
apiKeyYes-Connects your AI Agent to Rapidflare. Do not share outside your enterprise.
themeOptional-Set to light or dark to match your site's color theme.
userIdOptional-We recommend setting userId to the current user's email for usage tracking and feedback.
positionOptional-Initial position of the widget: bottom-right, bottom-left, top-right, top-left. Defaults to bottom-right; users can drag to any corner.
widgetTriggerSelectorOptional-CSS selector for the element that opens the floating launcher (e.g. your own button). If omitted, the default launcher is shown.
agentOptional-Which agent to render: qa or product-selection. Defaults to qa.
onLoadOptional-Called when the agent widget is loaded and ready.
onOpenOptional-Called when the agent widget is opened.
onCloseOptional-Called when the agent widget is closed.

Legacy widget versioning

Use this script URL: https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/latest/script.js. We recommend latest so you get updates automatically. To pin to a specific version:

MethodVersionURL
Pin to major, receive additive improvements and bug fixes3.xhttps://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/3.x/script.js
Pin to minor, receive only bug fixes3.0.xhttps://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/3.0.x/script.js
Pin to specific version3.0.4https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/3.0.4/script.js
Pin to latestlatesthttps://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/latest/script.js

The current latest version is 3.0.4.

Good to know!

The API keys we provide control authentication to Rapidflare. Please do not distribute these keys outside your enterprise.

What does versioning control?

The script version only affects how the widget is loaded and shown on your page. The AI Agent inside the widget keeps getting updates from us regardless of which script version you use. Your branding stays the same. If you pin to a specific version, you may miss new features. We recommend using latest.


← Back to Web deployment