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:
Option 1 (recommended)
<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) >>',
// Optional: uncomment and use above to create a custom selector
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) >>',
// Optional: uncomment and use above to create a custom selector
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
| Parameter | Required? | Default | Description |
|---|---|---|---|
apiKey | Yes | - | Connects your AI Agent to Rapidflare. Do not share outside your enterprise. |
theme | Optional | - | Set to light or dark to match your site's color theme. |
userId | Optional | - | We recommend setting userId to the current user's email for usage tracking and feedback. |
position | Optional | - | Initial position of the widget: bottom-right, bottom-left, top-right, top-left. Defaults to bottom-right; users can drag to any corner. |
widgetTriggerSelector | Optional | - | CSS selector for the element that opens the floating launcher (e.g. your own button). If omitted, the default launcher is shown. |
agent | Optional | - | Which agent to render: qa or product-selection. Defaults to qa. |
onLoad | Optional | - | Called when the agent widget is loaded and ready. |
onOpen | Optional | - | Called when the agent widget is opened. |
onClose | Optional | - | 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:
| Method | Version | URL |
|---|---|---|
| Pin to major, receive additive improvements and bug fixes | 3.x | https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/3.x/script.js |
| Pin to minor, receive only bug fixes | 3.0.x | https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/3.0.x/script.js |
| Pin to specific version | 3.0.4 | https://cloud.rapidflare.ai/storage/v1/object/public/rapidflare-copilot-widget/3.0.4/script.js |
| Pin to latest | latest | https://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.