AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-sdk-javascript |
| AI Features | AI Agents, AI Moderation, AI User Copilot |
| Activation | Enable from CometChat Dashboard |
| Prerequisites | CometChat.init() + CometChat.login() completed |
| AI Agents | Real-time streaming via AIAssistantListener, persisted messages via MessageListener |
| AI Moderation | Automatic content moderation with PENDING → APPROVED / DISAPPROVED flow |
| AI User Copilot | Smart Replies, Conversation Starter, Conversation Summary (Dashboard-enabled) |
Overview
CometChat provides three AI-powered features to enhance your chat application:| Feature | Description | Use Case |
|---|---|---|
| AI Agents | Intelligent automated conversations with real-time streaming | Chatbots, virtual assistants, automated support |
| AI Moderation | Automatic content moderation for text, image, and video messages | Safety, compliance, content filtering |
| AI User Copilot | Smart replies, conversation starters, and summaries | Enhanced user experience, productivity |
AI Features Summary
AI Agents
AI Agents enable intelligent, automated interactions. They process user messages, trigger tools, and respond with contextually relevant information. Key Points:- Agents only respond to text messages
- Real-time events via
AIAssistantListener - Persisted messages via
MessageListener - Event flow: Run Start → Tool Call(s) → Text Message Stream → Run Finished
- JavaScript
- TypeScript
AI Moderation
AI Moderation automatically reviews messages for inappropriate content in real-time. Key Points:- Supports Text, Image, and Video messages only
- Moderation statuses:
PENDING→APPROVEDorDISAPPROVED - Enable and configure rules in the CometChat Dashboard
- JavaScript
- TypeScript
AI User Copilot
AI User Copilot provides smart features that enhance user productivity. These features are enabled in the Dashboard and auto-integrate with UI Kits.| Feature | Description | Documentation |
|---|---|---|
| Conversation Starter | AI-generated opening lines for new chats | Learn more |
| Smart Replies | AI-generated response suggestions | Learn more |
| Conversation Summary | AI-generated recap of long conversations | Learn more |
Configuration Options
AI Agents Configuration
| Parameter | Type | Description |
|---|---|---|
listenerId | string | Unique identifier for the listener |
onAIAssistantEventReceived | function | Callback for real-time streaming events |
onAIAssistantMessageReceived | function | Callback for persisted assistant messages |
onAIToolResultReceived | function | Callback for tool execution results |
onAIToolArgumentsReceived | function | Callback for tool arguments |
AI Moderation Configuration
| Parameter | Type | Description |
|---|---|---|
listenerID | string | Unique identifier for the listener |
onMessageModerated | function | Callback when moderation result is available |
Moderation Status Values
| Status | Enum | Description |
|---|---|---|
| Pending | CometChat.ModerationStatus.PENDING | Message is being processed |
| Approved | CometChat.ModerationStatus.APPROVED | Message passed moderation |
| Disapproved | CometChat.ModerationStatus.DISAPPROVED | Message was blocked |
Next Steps
AI Agents
Full documentation for AI Agents integration
AI Moderation
Complete AI Moderation implementation guide
AI User Copilot
Smart Replies, Conversation Starter, and Summary
Troubleshooting
Common issues and fixes