Overview
Starting from version 2.17.0 of JavaScript SDK, the AI functionality is enabled and based on SmartChat Assistants. The QuickBlox JavaScript SDK provides a range of features to enhance the chat experience. With essential messaging functionalities such as answer assistant, users can engage in more interactive conversations. Supported features| Name | Description | Min SDK Version |
|---|---|---|
| AI Answer Assist | Generates a draft response based on chat history for the selected message. | 2.17.0 |
| AI Translate | Provides translation based on chat history to selected incoming message. | 2.17.0 |
| AI Gateway | Multimodal AI with text and images support (OpenAI-compatible format). | 2.21.5 |
| AI Summarize | Generates a summary of dialog messages (up to 1000 recent messages). | 2.21.5 |
Requirements
The minimum requirements for using AI features are:- JS QuickBlox SDK v2.17.0 (for AI Answer Assist and AI Translate)
- JS QuickBlox SDK v2.21.5 (for AI Gateway and AI Summarize)
- QuickBlox account with activated SmartChat Assistants
Before you begin
- Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
- Configure QuickBlox SDK for your app. Check out Setup page for more details.
- Create a user session to be able to use QuickBlox functionality. See Authentication page to learn how to do it.
- Create or update your SmartChat Assistant. See Smart Chat Assistant documentation to learn how to do it.
Enable AI Extensions
- Navigate to the Dashboard => YOUR_APP => AI Extensions page.
- Select the checkboxes for the features you want to enable.
- Click the Save button to save changes.

Get SmartChat Assistant ID
To get the SmartChat Assistant ID, navigate to the Dashboard => YOUR_APP => SmartChat Assistant page. The ID is displayed in the list of assistants.
AI Answer Assist
QuickBlox AI Answer Assist generates a contextually relevant draft response based on the chat history. Use it to suggest replies that match the conversation context.JavaScript
| Argument | Type | Description |
|---|---|---|
| smartChatAssistantId | String | This field should hold your actual Smart Chat Assistant ID that you’ll receive from the QuickBlox account. This ID is used to authenticate your requests to the AI service. |
| messageToAssist | String | Message you want to get answer for. |
| history | Array of Object | Conversation history. Used to add context. Each object of array should have the two fields: ‘role’ and ‘message’. The field role should contains one of next values: ‘user’ or ‘assistant’. The field message should be a string with chat message. |
| callback | function | The callback function. |
AI Translate
QuickBlox offers translation functionality that helps users easily translate text messages in chat, taking into account the context of the chat history.TypeScript
| Argument | Type | Description |
|---|---|---|
| smartChatAssistantId | String | This field should hold your actual Smart Chat Assistant ID that you’ll receive from the QuickBlox account. This ID is used to authenticate your requests to the AI service. |
| textToTranslate | String | Text to translate. |
| languageCode | String | Target language code in ISO 639-1 format (e.g., en, es, fr, de). See AI Translate API for the list of supported languages. |
| callback | function | The callback function. |
AI Gateway
Available starting from SDK version 2.21.5
JavaScript
JavaScript
JavaScript
| Argument | Type | Description |
|---|---|---|
| smartChatAssistantId | String | This field should hold your actual Smart Chat Assistant ID that you’ll receive from the QuickBlox account. This ID is used to authenticate your requests to the AI service. |
| messages | Array of Object | Array of message objects in OpenAI-compatible format. See message structure below. |
| callback | function | The callback function. |
messages array should have the following structure:
| Field | Type | Description |
|---|---|---|
| role | String | One of: 'user', 'assistant', or 'developer' (for system prompts). |
| content | Array of Object | Array of content items. Each item can be text or image_url type. |
AI Summarize
Available starting from SDK version 2.21.5
JavaScript
| Argument | Type | Description |
|---|---|---|
| smartChatAssistantId | String | This field should hold your actual Smart Chat Assistant ID that you’ll receive from the QuickBlox account. This ID is used to authenticate your requests to the AI service. |
| dialogId | String | The ID of the dialog to summarize. |
| callback | function | The callback function. |
summary field with the generated summary text:
- AI Summarize processes up to 1,000 most recent messages in the dialog.
- For empty dialogs, the response will be
{ summary: "Chat is empty." }. - The user must have access to the dialog to summarize it.