XR AI SDK
Intelligent Agent Integration Platform
Try it out
Choose how the AI assistant appears on your page. The "Recent Sessions" sidebar now overlays the main chat area for better accessibility.
Quick Start
1. Include the SDK
For development environment, use the following script tag to include the SDK in your HTML:
<script src="https://xr-agent.vercel.dev-extremereach.com/ai-sdk.js"></script>
For production environment, use the following script tag to include the SDK in your HTML:
<script src="https://xr-agent.extremereach.com/ai-sdk.js"></script>
The SDK auto-initializes with default settings.
XRAISDK
object will become available as an attribute of the global
window object.
2. Configure
XRAISDK.setup({ ... // check the API Reference below for more details });
Customize the SDK behavior for your needs
API Reference
XRAISDK.setup(config)
Initialize or reconfigure the SDK with custom settings.
XRAISDK.setup({
// 'widget' or 'embed', for embed, call XRAISDK.renderTo() to render to a specific DOM element
renderType: 'widget',
resources: [
{
type: 'asset',
attributes: {
assetType: 'HTML5',
files: [/* file objects */],
attachments: [/* attachment objects */]
}
}
]
// optional, default to current page's title
title: window.document.title,
// optional, default to current page's URL
uri: window.location.href,
// optional, default to xr-agent.extremereach.com for production or xr-agent.vercel.dev-extremereach.com for development based on current page domain
serviceUrl: 'https://xr-agent.vercel.dev-extremereach.com',
// 'light', 'dark', or 'auto' (default)
theme: 'auto',
onClose: function () {
// callback when the close button is clicked
},
onMessage: function (message) {
// callback when a message is received from the pub-sub
// message has shape of { name: string, data: string }
},
});
Configuration Methods
XRAISDK.updateConfig(config)
Update existing configuration
XRAISDK.getConfig()
Retrieve current configuration
Rendering Methods
XRAISDK.renderTo(selectorOrDOMElement)
Render to specific DOM element
XR AI SDK Demo - Integration made simple