Skip to main content

Overview

The AI Chat SDK provides extensive configuration options to control features, customize appearance, and integrate with your data sources. All configuration is passed during SDK initialization.

Initialization signature

Required parameters

apiKey

Type: string Your API key for authentication with the chat backend.
Contact support@onsleek.com to receive your API key.

Configuration options

enableDebug

Enable detailed console logging for debugging.
Example:
Debug mode should be disabled in production builds to reduce console noise and improve performance.

Chat configuration

Configure the chat panel behavior, styling, and content using chatConfig.

isFloating

Applies floating panel styles (border, border-radius, box shadow) when enabled. Set to false for a flat/embedded appearance.

usePageContext

When enabled, the AI can reference and respond based on what the user is currently viewing on the page.

messageLimitPerThread

Maximum number of messages per conversation thread.

content

Customize text content displayed in the chat interface.

assistant

Configure the AI assistant’s identity.

brand

Configure your brand identity.

styling

Configure colors and fonts. See the Customization guide for details.

layout

Configure the chat panel’s position and size. See Layout configuration below.

Badge configuration

Configure the floating badge entry point using badgeConfig.

allowExpand

Whether the badge can expand on hover to show prompts.

autoCollapse

Whether the badge automatically collapses after a delay.

restoreBadgeOnChatClose

Whether to restore the badge after the user closes the chat dialog. When enabled, the badge reappears instantly without requiring a page refresh or additional SDK call. Only applies if the badge was previously shown. If the user explicitly dismisses the badge (via the close button), it will not be restored after chat close.

content

Customize badge text content.

Inline configuration

Configure the inline input entry point using inlineConfig.

layout (inline)

For inline rendering, you must specify a container selector.

content

Customize inline input text.

Layout configuration

Control positioning and sizing for chat panel and badge.

Position

Size

Common layout examples

Data providers

Integrate your offer redirect URLs and cashback data into chat conversations. See the Data Providers guide for detailed implementation.
Type definitions:
Example:
Data providers must handle errors gracefully and return null (for offer redirect URLs) or {} (for cashback) on failure. Never throw exceptions.

Complete configuration example

Here’s a complete example with all commonly used options:

Environment-specific configuration

For different environments (development, staging, production), use environment variables:

Type reference

All configuration types are exported from the SDK: