Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions sdk/flutter/additional-message-filtering.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
---
title: "Additional Message Filtering"
description: "Learn how to use MessagesRequestBuilder to filter and fetch messages with various parameters including pagination, categories, types, tags, and advanced search options in Flutter."
---

{/* TL;DR for Agents and Quick Reference */}
<Info>
**Quick Reference for AI Agents & Developers**

```dart
// Basic message request for user conversation
MessagesRequest request = (MessagesRequestBuilder()
..uid = "user_uid"
..limit = 30
).build();

// Fetch messages for group with filters
MessagesRequest request = (MessagesRequestBuilder()
..guid = "group_guid"
..limit = 50
..categories = ["message", "custom"]
..types = ["text", "image"]
..hideReplies = true
).build();

// Fetch unread messages only
MessagesRequest request = (MessagesRequestBuilder()
..uid = "user_uid"
..unread = true
..limit = 50
).build();

// Paginate through messages
List<BaseMessage> messages = await request.fetchPrevious();
List<BaseMessage> moreMessages = await request.fetchPrevious(); // Next page
```
</Info>

The `MessagesRequest` class as you must be familiar with helps you to fetch messages based on the various parameters provided to it. This document will help you understand better the various options that are available using the `MessagesRequest` class.

Expand Down Expand Up @@ -521,3 +553,22 @@ MessagesRequest messageRequest = (MessagesRequestBuilder()
</Tab>

</Tabs>

---

## Next Steps

<CardGroup cols={2}>
<Card title="Receive Messages" icon="inbox" href="/sdk/flutter/receive-messages">
Handle incoming messages in real-time with listeners
</Card>
<Card title="Retrieve Conversations" icon="comments" href="/sdk/flutter/retrieve-conversations">
Fetch and display conversation lists with filtering options
</Card>
<Card title="Message Structure" icon="sitemap" href="/sdk/flutter/message-structure-and-hierarchy">
Understand message categories, types, and hierarchy
</Card>
<Card title="Threaded Messages" icon="layer-group" href="/sdk/flutter/threaded-messages">
Work with message threads and replies
</Card>
</CardGroup>
33 changes: 32 additions & 1 deletion sdk/flutter/advanced-overview.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
---
title: "Advanced"
sidebarTitle: "Overview"
description: "Advanced SDK features including connection management, real-time listeners, and login state handling for Flutter applications."
---

{/* TL;DR for Agents and Quick Reference */}
<Info>
**Quick Reference for AI Agents & Developers**

Choose your path:
- **Connection Status** → [connection-status](/sdk/flutter/connection-status) - Monitor SDK connection state
- **Connection Behaviour** → [connection-behaviour](/sdk/flutter/connection-behaviour) - Understand connection lifecycle
- **Login Listeners** → [login-listeners](/sdk/flutter/login-listeners) - Handle login state changes
- **Real-Time Listeners** → [real-time-listeners](/sdk/flutter/real-time-listeners) - All event listeners reference
</Info>

This section helps you to know about the Connection Listeners.
This section covers advanced SDK features for managing connections, monitoring real-time events, and handling login state changes in your Flutter application.

These features help you build robust applications that gracefully handle network changes, maintain real-time synchronization, and respond to authentication events.

---

## Next Steps

<CardGroup cols={2}>
<Card title="Connection Status" icon="signal" href="/sdk/flutter/connection-status">
Monitor and respond to SDK connection state changes
</Card>
<Card title="Real-Time Listeners" icon="tower-broadcast" href="/sdk/flutter/real-time-listeners">
Complete reference for all event listeners
</Card>
<Card title="Login Listeners" icon="user-check" href="/sdk/flutter/login-listeners">
Handle login and logout state changes
</Card>
<Card title="Connection Behaviour" icon="network-wired" href="/sdk/flutter/connection-behaviour">
Understand SDK connection lifecycle
</Card>
</CardGroup>
52 changes: 51 additions & 1 deletion sdk/flutter/ai-agents.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
---
title: "AI Agents"
description: "Learn how to integrate AI Agents in your Flutter app to enable intelligent, automated interactions that process user messages, trigger tools, and respond with contextually relevant information."
---

{/* TL;DR for Agents and Quick Reference */}
<Info>
**Quick Reference for AI Agents & Developers**

```dart
// Add AI Assistant listener for real-time events
CometChat.addAIAssistantListener("LISTENER_ID", AIAssistantListener(
onAIAssistantEventReceived: (AIAssistantBaseEvent event) {
debugPrint("AI Event: ${event.type}");
},
));

// Add Message listener for agentic messages
CometChat.addMessageListener("LISTENER_ID", MessageListener(
onAIAssistantMessageReceived: (AIAssistantMessage msg) {
debugPrint("AI Reply: ${msg.text}");
},
onAIToolResultReceived: (AIToolResultMessage result) {
debugPrint("Tool Result: $result");
},
));

// Remove listeners when done
CometChat.removeAIAssistantListener("LISTENER_ID");
CometChat.removeMessageListener("LISTENER_ID");
```
</Info>

# AI Agents Overview

AI Agents enable intelligent, automated interactions within your application. They can process user messages, trigger tools, and respond with contextually relevant information. For a broader introduction, see the [AI Agents section](/ai-agents).

<Note>
**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/react/overview) | [Dashboard](https://app.cometchat.com)
</Note>

> **Note:**
> Currently, an Agent only responds to **Text Messages**.

Expand Down Expand Up @@ -68,6 +101,10 @@ class AIAssistantEventHandler with AIAssistantListener {
</Tab>
</Tabs>

<Warning>
Always remove AI Assistant listeners when they're no longer needed (e.g., on widget dispose or page navigation). Failing to remove listeners can cause memory leaks and duplicate event handling.
</Warning>

#### Event descriptions
- Run Start: A new run has begun for the user’s message.
- Tool Call Start: The agent decided to invoke a tool.
Expand Down Expand Up @@ -111,4 +148,17 @@ These events are received via the **`MessageListener`** after the run completes.
}
```
</Tab>
</Tabs>
</Tabs>

---

## Next Steps

<CardGroup cols={2}>
<Card title="AI Chatbots" icon="robot" href="/sdk/flutter/ai-chatbots-overview">
Configure and deploy AI chatbots for automated conversations
</Card>
<Card title="AI Moderation" icon="shield-check" href="/sdk/flutter/ai-moderation">
Implement AI-powered content moderation for your chat
</Card>
</CardGroup>
49 changes: 49 additions & 0 deletions sdk/flutter/ai-chatbots-overview.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
---
title: "Bots"
sidebarTitle: "AI Bots"
description: "Configure AI-powered chatbots to provide automated assistance and maintain conversational momentum in your Flutter app."
url: "/ai-chatbots/overview"
---

{/* TL;DR for Agents and Quick Reference */}
<Info>
**Quick Reference for AI Agents & Developers**

```dart
// AI Bots are configured via the CometChat Dashboard
// Navigate to: AI Agents > Custom Bots > AI Bots

// Configuration options:
// 1. Set GPT Model (e.g., gpt-4, gpt-3.5-turbo)
// 2. Add your OpenAI API Key
// 3. Set Custom Instructions for bot behavior
// 4. Configure Temperature (0-1) for response creativity
// 5. Enable AI toggle

// Once configured, bots respond automatically to user messages
// No additional SDK code required - bots work via CometChat backend
```

**Dashboard Path:** [CometChat Dashboard](https://app.cometchat.com) → Your App → AI Agents → Custom Bots → AI Bots
</Info>

AI Bots provide automated assistance to users seeking guidance or insights. Configure intelligent chatbots through the CometChat Dashboard to maintain conversational momentum in your Flutter application.

<Note>
**Available via:** [Dashboard](https://app.cometchat.com) | [REST API](https://api-explorer.cometchat.com) | UI Kits
</Note>

---

## Next Steps

<CardGroup cols={2}>
<Card title="AI Agents" icon="robot" href="/sdk/flutter/ai-agents">
Build custom AI agents that respond to user queries
</Card>
<Card title="AI Moderation" icon="shield-check" href="/sdk/flutter/ai-moderation">
Automatically moderate content using AI
</Card>
<Card title="AI User Copilot" icon="wand-magic-sparkles" href="/sdk/flutter/ai-user-copilot-overview">
Enhance user experience with AI-powered assistance
</Card>
<Card title="Send Messages" icon="paper-plane" href="/sdk/flutter/send-message">
Learn how to send messages that bots can respond to
</Card>
</CardGroup>
50 changes: 49 additions & 1 deletion sdk/flutter/ai-moderation.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
---
title: "AI Moderation"
description: "Learn how to implement AI-powered content moderation in your Flutter app using CometChat SDK to automatically review messages for inappropriate content."
---

{/* TL;DR for Agents and Quick Reference */}
<Info>
**Quick Reference for AI Agents & Developers**

```dart
// Send message and check moderation status
CometChat.sendMessage(textMessage, onSuccess: (TextMessage message) {
if (message.moderationStatus?.value == ModerationStatusEnum.PENDING.value) {
// Message is under moderation review
}
}, onError: (e) {});

// Listen for moderation results
CometChat.addMessageListener("MODERATION_LISTENER", MessageListener(
onMessageModerated: (BaseMessage message) {
// Handle APPROVED or DISAPPROVED status
},
));

// Remove listener when done
CometChat.removeMessageListener("MODERATION_LISTENER");
```

**Moderation Status:** `PENDING` → `APPROVED` or `DISAPPROVED`
**Supported Types:** Text, Image, Video messages
</Info>

## Overview

AI Moderation in the CometChat SDK helps ensure that your chat application remains safe and compliant by automatically reviewing messages for inappropriate content. This feature leverages AI to moderate messages in real-time, reducing manual intervention and improving user experience.

<Note>
**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) | [Dashboard](https://app.cometchat.com)
</Note>

<Note>
For a broader understanding of moderation features, configuring rules, and managing flagged messages, see the [Moderation Overview](/moderation/overview).
</Note>
Expand Down Expand Up @@ -172,4 +204,20 @@ When a message is disapproved, handle it appropriately in your UI:
</Tabs>

## Next Steps
After implementing AI Moderation, consider adding a reporting feature to allow users to flag messages they find inappropriate. For more details, see the [Flag Message](/sdk/flutter/flag-message) documentation.

After implementing AI Moderation, explore these related features:

<CardGroup cols={2}>
<Card title="AI Agents" icon="robot" href="/sdk/flutter/ai-agents">
Build intelligent AI-powered agents for automated conversations
</Card>
<Card title="Flag Message" icon="flag" href="/sdk/flutter/flag-message">
Allow users to manually report inappropriate messages
</Card>
<Card title="AI Chatbots" icon="comments" href="/sdk/flutter/ai-chatbots-overview">
Create automated chatbot experiences for your users
</Card>
<Card title="Receive Messages" icon="inbox" href="/sdk/flutter/receive-messages">
Handle incoming messages and moderation events
</Card>
</CardGroup>
47 changes: 47 additions & 0 deletions sdk/flutter/authentication-overview.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
---
title: "Authentication"
sidebarTitle: "Overview"
description: "Learn how to authenticate users in your Flutter app using CometChat SDK with Auth Key for development or Auth Token for production."
---

{/* TL;DR for Agents and Quick Reference */}
<Info>
**Quick Reference for AI Agents & Developers**

```dart
// Check if user is already logged in
User? user = await CometChat.getLoggedInUser();

// Login with Auth Key (Development only)
CometChat.login(UID, authKey,
onSuccess: (User user) { debugPrint("Login successful: $user"); },
onError: (CometChatException e) { debugPrint("Login failed: ${e.message}"); }
);

// Login with Auth Token (Production)
CometChat.loginWithAuthToken(authToken,
onSuccess: (User user) { debugPrint("Login successful: $user"); },
onError: (CometChatException e) { debugPrint("Login failed: ${e.message}"); }
);

// Logout
CometChat.logout(
onSuccess: (String msg) { debugPrint("Logout successful"); },
onError: (CometChatException e) { debugPrint("Logout failed: ${e.message}"); }
);
```

**Required Credentials:** App ID, Region, Auth Key (dev) or Auth Token (prod)
**Get from:** [CometChat Dashboard](https://app.cometchat.com) → Your App → API & Auth Keys
</Info>

### Create User

Expand Down Expand Up @@ -32,6 +62,10 @@ The CometChat SDK maintains the session of the logged-in user within the SDK. Th

This straightforward authentication method is ideal for proof-of-concept (POC) development or during the early stages of application development. For production environments, however, we strongly recommend using an [AuthToken](#login-using-auth-token) instead of an Auth Key to ensure enhanced security.

<Warning>
**Auth Key** is for development/testing only. In production, generate **Auth Tokens** on your server using the REST API and pass them to the client. Never expose Auth Keys in production client code.
</Warning>

<Tabs>
<Tab title="Dart">
```dart
Expand Down Expand Up @@ -113,3 +147,16 @@ CometChat.logout( onSuccess: ( successMessage) {
</Tab>

</Tabs>

---

## Next Steps

<CardGroup cols={2}>
<Card title="Send Messages" icon="paper-plane" href="/sdk/flutter/send-message">
Start sending text, media, and custom messages
</Card>
<Card title="User Management" icon="users-gear" href="/sdk/flutter/user-management">
Create, update, and manage users in your app
</Card>
</CardGroup>
Loading