diff --git a/sdk/flutter/additional-message-filtering.mdx b/sdk/flutter/additional-message-filtering.mdx index 01dcd182d..c52accb89 100644 --- a/sdk/flutter/additional-message-filtering.mdx +++ b/sdk/flutter/additional-message-filtering.mdx @@ -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 */} + +**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 messages = await request.fetchPrevious(); +List moreMessages = await request.fetchPrevious(); // Next page +``` + 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. @@ -521,3 +553,22 @@ MessagesRequest messageRequest = (MessagesRequestBuilder() + +--- + +## Next Steps + + + + Handle incoming messages in real-time with listeners + + + Fetch and display conversation lists with filtering options + + + Understand message categories, types, and hierarchy + + + Work with message threads and replies + + diff --git a/sdk/flutter/advanced-overview.mdx b/sdk/flutter/advanced-overview.mdx index 7a8e791f6..df3741722 100644 --- a/sdk/flutter/advanced-overview.mdx +++ b/sdk/flutter/advanced-overview.mdx @@ -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 */} + +**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 + -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 + + + + Monitor and respond to SDK connection state changes + + + Complete reference for all event listeners + + + Handle login and logout state changes + + + Understand SDK connection lifecycle + + diff --git a/sdk/flutter/ai-agents.mdx b/sdk/flutter/ai-agents.mdx index 1ee853823..d1d987c19 100644 --- a/sdk/flutter/ai-agents.mdx +++ b/sdk/flutter/ai-agents.mdx @@ -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 */} + +**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"); +``` + + # 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). + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/react/overview) | [Dashboard](https://app.cometchat.com) + + > **Note:** > Currently, an Agent only responds to **Text Messages**. @@ -68,6 +101,10 @@ class AIAssistantEventHandler with AIAssistantListener { + +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. + + #### Event descriptions - Run Start: A new run has begun for the user’s message. - Tool Call Start: The agent decided to invoke a tool. @@ -111,4 +148,17 @@ These events are received via the **`MessageListener`** after the run completes. } ``` - \ No newline at end of file + + +--- + +## Next Steps + + + + Configure and deploy AI chatbots for automated conversations + + + Implement AI-powered content moderation for your chat + + \ No newline at end of file diff --git a/sdk/flutter/ai-chatbots-overview.mdx b/sdk/flutter/ai-chatbots-overview.mdx index 7a460169b..a39abd3f8 100644 --- a/sdk/flutter/ai-chatbots-overview.mdx +++ b/sdk/flutter/ai-chatbots-overview.mdx @@ -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 */} + +**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 + + +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. + + +**Available via:** [Dashboard](https://app.cometchat.com) | [REST API](https://api-explorer.cometchat.com) | UI Kits + + +--- + +## Next Steps + + + + Build custom AI agents that respond to user queries + + + Automatically moderate content using AI + + + Enhance user experience with AI-powered assistance + + + Learn how to send messages that bots can respond to + + diff --git a/sdk/flutter/ai-moderation.mdx b/sdk/flutter/ai-moderation.mdx index e0414eb82..5b69c125c 100644 --- a/sdk/flutter/ai-moderation.mdx +++ b/sdk/flutter/ai-moderation.mdx @@ -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 */} + +**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 + + ## 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. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) | [Dashboard](https://app.cometchat.com) + + For a broader understanding of moderation features, configuring rules, and managing flagged messages, see the [Moderation Overview](/moderation/overview). @@ -172,4 +204,20 @@ When a message is disapproved, handle it appropriately in your UI: ## 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: + + + + Build intelligent AI-powered agents for automated conversations + + + Allow users to manually report inappropriate messages + + + Create automated chatbot experiences for your users + + + Handle incoming messages and moderation events + + diff --git a/sdk/flutter/authentication-overview.mdx b/sdk/flutter/authentication-overview.mdx index 5157b3883..c6971dd65 100644 --- a/sdk/flutter/authentication-overview.mdx +++ b/sdk/flutter/authentication-overview.mdx @@ -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 */} + +**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 + ### Create User @@ -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. + +**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. + + ```dart @@ -113,3 +147,16 @@ CometChat.logout( onSuccess: ( successMessage) { + +--- + +## Next Steps + + + + Start sending text, media, and custom messages + + + Create, update, and manage users in your app + + diff --git a/sdk/flutter/block-users.mdx b/sdk/flutter/block-users.mdx index 8613e6df1..a08b46d8e 100644 --- a/sdk/flutter/block-users.mdx +++ b/sdk/flutter/block-users.mdx @@ -1,8 +1,39 @@ --- title: "Block Users" +description: "Learn how to block and unblock users in your Flutter app using the CometChat SDK to manage user interactions and privacy." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Block users +List uids = ["UID1", "UID2"]; +CometChat.blockUser(uids, onSuccess: (Map map) { + debugPrint("Blocked: $map"); +}, onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); +}); + +// Unblock users +CometChat.unblockUser(uids, onSuccess: (Map map) { + debugPrint("Unblocked: $map"); +}, onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); +}); + +// Get blocked users list +BlockedUsersRequest request = (BlockedUsersRequestBuilder()..limit = 30).build(); +request.fetchNext(onSuccess: (List users) { }, onError: (e) { }); +``` + + +Block users to prevent them from sending messages to the logged-in user. This feature helps users manage their privacy and control who can communicate with them. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + ## Block Users @@ -138,3 +169,22 @@ blockedUsersRequest.fetchNext(onSuccess: (List userList){ + +--- + +## Next Steps + + + + Fetch and filter users from your CometChat app + + + Create, update, and delete users programmatically + + + Track online/offline status of users in real-time + + + Complete guide to user features in CometChat + + diff --git a/sdk/flutter/call-logs.mdx b/sdk/flutter/call-logs.mdx index 7965eaa21..fed225603 100644 --- a/sdk/flutter/call-logs.mdx +++ b/sdk/flutter/call-logs.mdx @@ -1,13 +1,44 @@ --- title: "Call Logs" +description: "Learn how to fetch and manage call logs in your Flutter application using CometChat's Call SDK, including filtering by call type, status, and direction." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Build call log request +CallLogRequest callLogRequest = (CallLogRequestBuilder() + ..authToken = CometChat.getUserAuthToken() + ..limit = 30 + ..callCategory = CometChatCallsConstants.callCategoryCall +).build(); + +// Fetch call logs +callLogRequest.fetchNext(onSuccess: (List callLogs) { + debugPrint("Call logs fetched: ${callLogs.length}"); +}, onError: (CometChatCallsException e) { + debugPrint("Error: ${e.message}"); +}); + +// Get specific call details +CometChatCalls.getCallDetails(sessionID, userAuthToken, onSuccess: (List callLogs) { + debugPrint("Call details: $callLogs"); +}, onError: (CometChatCallsException e) { + debugPrint("Error: ${e.message}"); +}); +``` + ## Overview CometChat's Flutter Call SDK provides a comprehensive way to integrate call logs into your application, enhancing your user experience by allowing users to effortlessly keep track of their communication history. Call logs provide crucial information such as call duration, participants, and more. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [Dashboard](https://app.cometchat.com) + + This feature not only allows users to review their past interactions but it also serves as an effective tool to revisit important conversation details. With the flexibility of fetching call logs, filtering them according to specific parameters, and obtaining detailed information of individual calls, application developers can use this feature to build a more robust and interactive communication framework. In the following sections, we will guide you through the process of working with call logs, offering a deeper insight into how to optimally use this feature in your Flutter application. @@ -90,3 +121,22 @@ CometChatCalls.getCallDetails(sessionID, userAuthToken, onSuccess: (List + + Implement voice and video calls with ringing functionality + + + Learn how to record calls and access recordings + + + Start calls without the ringing flow + + + Configure the CometChat Calls SDK + + diff --git a/sdk/flutter/calling-overview.mdx b/sdk/flutter/calling-overview.mdx index 61fbffcfe..d1e61e72d 100644 --- a/sdk/flutter/calling-overview.mdx +++ b/sdk/flutter/calling-overview.mdx @@ -1,8 +1,22 @@ --- title: "Calling" sidebarTitle: "Overview" +description: "Implement voice and video calling in your Flutter application with CometChat's calling SDK, supporting ringing calls, direct calls, and standalone calling." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +Choose your calling approach: +- **Setup** → [calling-setup](/sdk/flutter/calling-setup) - Install and configure calling SDK +- **Default Calling** → [default-call](/sdk/flutter/default-call) - Ringing calls with accept/reject +- **Direct Calling** → [direct-call](/sdk/flutter/direct-call) - Direct calls without ringing +- **Standalone Calling** → [standalone-calling](/sdk/flutter/standalone-calling) - Calls without chat SDK +- **Call Logs** → [call-logs](/sdk/flutter/call-logs) - Retrieve call history +- **Recording** → [recording](/sdk/flutter/recording) - Record calls + + ## Overview CometChat provides voice and video calling capabilities for your Flutter application. This guide helps you choose the right implementation approach based on your use case. @@ -88,3 +102,22 @@ Use this when you want: Configure automatic call termination when participants are inactive. + +--- + +## Next Steps + + + + Install and configure the calling SDK + + + Implement ringing calls with accept/reject + + + Start direct call sessions without ringing + + + Retrieve and display call history + + diff --git a/sdk/flutter/calling-setup.mdx b/sdk/flutter/calling-setup.mdx index eb0dc43ea..f83168236 100644 --- a/sdk/flutter/calling-setup.mdx +++ b/sdk/flutter/calling-setup.mdx @@ -1,8 +1,37 @@ --- title: "Setup" +sidebarTitle: "Calling Setup" +description: "Learn how to install and initialize the CometChat Calls SDK for Flutter to enable voice and video calling in your application." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```yaml +# pubspec.yaml +dependencies: + cometchat_calls_sdk: ^4.2.2 +``` + +```dart +// Import the SDK +import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart'; + +// Initialize Calls SDK +CallAppSettings callAppSettings = (CallAppSettingBuilder() + ..appId = "APP_ID" + ..region = "REGION" +).build(); + +CometChatCalls.init(callAppSettings, + onSuccess: (String message) => debugPrint("Calls SDK initialized"), + onError: (CometChatCallsException e) => debugPrint("Error: ${e.message}"), +); +``` + +**Required:** App ID, Region from [CometChat Dashboard](https://app.cometchat.com) + ### Get your Application Keys @@ -81,3 +110,16 @@ debugPrint("Initialization failed with exception: ${e.message}"); | Parameter | Description | | ----------------- | -------------------------------------- | | `callAppSettings` | An object of the CallAppSettings class | + +--- + +## Next Steps + + + + Implement ringing calls with accept/reject functionality + + + Start direct call sessions without ringing + + diff --git a/sdk/flutter/connection-behaviour.mdx b/sdk/flutter/connection-behaviour.mdx index ba5b683a9..23615c1ed 100644 --- a/sdk/flutter/connection-behaviour.mdx +++ b/sdk/flutter/connection-behaviour.mdx @@ -1,8 +1,37 @@ --- title: "Connection Behaviour" +description: "Understand how CometChat SDK manages WebSocket connections in auto and manual modes, including background behavior and reconnection handling." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Auto Mode (default) - SDK manages connection automatically +AppSettings appSettings = (AppSettingsBuilder() + ..subscriptionType = CometChatSubscriptionType.allUsers + ..region = "REGION" + ..autoEstablishSocketConnection = true // Default behavior +).build(); + +// Manual Mode - You control the connection +AppSettings appSettings = (AppSettingsBuilder() + ..subscriptionType = CometChatSubscriptionType.allUsers + ..region = "REGION" + ..autoEstablishSocketConnection = false // Manual control +).build(); + +// Manual mode methods +CometChat.connect(onSuccess: (msg) {}, onError: (e) {}); // Establish connection +CometChat.disconnect(onSuccess: (msg) {}, onError: (e) {}); // Break connection +CometChat.ping(onSuccess: () {}, onError: (e) {}); // Keep alive in background +``` + +**Connection Modes:** +- **Auto Mode:** SDK manages WebSocket automatically (foreground=connected, background=disconnected) +- **Manual Mode:** You control connect/disconnect; call `ping()` every 30s to keep background connection alive + ## Default SDK behaviour on login @@ -164,3 +193,22 @@ CometChat.ping( ## Reconnection If manual mode is enabled and the app is in the foreground, the SDK will automatically reconnect the WebSocket if the internet connection is lost. However, if the app is in the background and the WebSocket is disconnected or you called `CometChat.disconnect()`, then you will need to call the `CometChat.connect()` method to create a new WebSocket connection. + +--- + +## Next Steps + + + + Monitor real-time WebSocket connection status with listeners + + + Configure CometChat SDK initialization and settings + + + Learn about all available real-time event listeners + + + Implement user login and logout functionality + + diff --git a/sdk/flutter/connection-status.mdx b/sdk/flutter/connection-status.mdx index a0877d610..f9f6c4e00 100644 --- a/sdk/flutter/connection-status.mdx +++ b/sdk/flutter/connection-status.mdx @@ -1,8 +1,42 @@ --- title: "Connection Status" +description: "Monitor real-time WebSocket connection status with CometChat SDK using ConnectionListener callbacks and getConnectionStatus method." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Add connection listener +CometChat.addConnectionListener("connection_listener", ConnectionListenerImpl()); + +// Connection listener implementation +class ConnectionListenerImpl with ConnectionListener { + @override + void onConnected() => debugPrint("Connected"); + + @override + void onConnecting() => debugPrint("Connecting..."); + + @override + void onDisconnected() => debugPrint("Disconnected"); + + @override + void onFeatureThrottled() => debugPrint("Feature throttled"); + + @override + void onConnectionError(CometChatException error) => debugPrint("Error: ${error.message}"); +} + +// Check current connection status +String status = CometChat.getConnectionStatus(); +// Returns: CometChatWSState.connected, connecting, disconnected, or featureThrottled + +// Remove listener when done +CometChat.removeConnectionListener("connection_listener"); +``` + CometChat SDK provides you with a mechanism to get real-time status of the connection to CometChat web-socket servers. To achieve this you need to use the `ConnectionListener` class provided by the CometChat SDK @@ -84,3 +118,16 @@ The above method will return either of the below 3 values: Know more about CometChat SDK connection behaviour [click here](/sdk/flutter/connection-behaviour) + +--- + +## Next Steps + + + + Understand how CometChat SDK manages WebSocket connections + + + Monitor user login and logout events in real-time + + diff --git a/sdk/flutter/create-group.mdx b/sdk/flutter/create-group.mdx index c5eba5686..4ee2d19e4 100644 --- a/sdk/flutter/create-group.mdx +++ b/sdk/flutter/create-group.mdx @@ -1,13 +1,35 @@ --- title: "Create A Group" +description: "Learn how to create public, private, and password-protected groups using CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Create a public group +Group group = Group(guid: "GUID", name: "Group Name", type: CometChatGroupType.public); + +await CometChat.createGroup( + group: group, + onSuccess: (Group group) => debugPrint("Created: ${group.name}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Group types: CometChatGroupType.public, .private, .password +// For password-protected groups, set password in Group constructor +``` + ## Create a Group *In other words, as a logged-in user, how do I create a public, private or password-protected group?* + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + You can create a group using `createGroup()` method. This method takes a `Group` object as input. The `groupType` needs to be either of the below 3 values: @@ -73,3 +95,22 @@ GUID can be alphanumeric with underscore and hyphen. Spaces, punctuation and oth | scope | Yes | Scope of the logged in user. Can be: 1. Admin 2. Moderator 3. Participant | | membersCount | No | The number of members in the groups | | tags | Yes | A list of tags to identify specific groups. | + +--- + +## Next Steps + + + + Join existing public or password-protected groups + + + Add members to your groups programmatically + + + List and fetch groups with filtering options + + + Modify group details and settings + + diff --git a/sdk/flutter/default-call.mdx b/sdk/flutter/default-call.mdx index e28cd7787..400a88499 100644 --- a/sdk/flutter/default-call.mdx +++ b/sdk/flutter/default-call.mdx @@ -1,11 +1,51 @@ --- title: "Ringing" +description: "Implement complete calling workflow with ringing functionality including incoming/outgoing call UI, call acceptance, rejection, and cancellation in your Flutter app." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// Initiate a call +Call call = Call( + receiverUid: "USER_ID", + receiverType: CometChatReceiverType.user, + type: CometChatCallType.video, +); + +await CometChat.initiateCall( + call, + onSuccess: (Call call) => debugPrint("Call initiated: ${call.sessionId}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Accept incoming call +await CometChat.acceptCall( + sessionId, + onSuccess: (Call call) => debugPrint("Call accepted"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Reject incoming call +await CometChat.rejectCall( + sessionId, + CometChatConstants.CALL_STATUS_REJECTED, + onSuccess: (Call call) => debugPrint("Call rejected"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + + ## Overview This section explains how to implement a complete calling workflow with ringing functionality, including incoming/outgoing call UI, call acceptance, rejection, and cancellation. Previously known as **Default Calling**. + +**Available via:** SDK | [UI Kits](/ui-kit/flutter/overview) + + After the call is accepted, you need to start the call session. See the [Call Session](/sdk/flutter/direct-call#start-call-session) guide for details on starting and managing the actual call. @@ -85,6 +125,10 @@ On success, a `Call` object is returned containing the call details including a Register the `CallListener` to receive real-time call events. Each listener requires a unique `listenerId` string to prevent duplicate registrations and enable targeted removal. + +Always remove call listeners when they're no longer needed (e.g., on widget dispose). Failing to remove listeners can cause memory leaks and duplicate event handling. + + ```dart String listenerId = "UNIQUE_LISTENER_ID"; @@ -322,3 +366,19 @@ CometChat.rejectCall( }, ); ``` + +--- + +## Next Steps + + + + Start direct call sessions without ringing + + + Retrieve and display call history + + + Record audio and video calls + + diff --git a/sdk/flutter/delete-conversation.mdx b/sdk/flutter/delete-conversation.mdx index 57473b8ca..23d0c8bd3 100644 --- a/sdk/flutter/delete-conversation.mdx +++ b/sdk/flutter/delete-conversation.mdx @@ -1,13 +1,43 @@ --- title: "Delete A Conversation" +description: "Learn how to delete user and group conversations from the logged-in user's conversation list using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Delete a user conversation +await CometChat.deleteConversation( + "UID", + CometChatConversationType.user, + onSuccess: (String message) => debugPrint("Deleted: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Delete a group conversation +await CometChat.deleteConversation( + "GUID", + CometChatConversationType.group, + onSuccess: (String message) => debugPrint("Deleted: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + In case you want to delete a conversation, you can use the `deleteConversation()` method. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + This method takes two parameters. The unique id (UID/GUID) of the conversation to be deleted & the type (user/group) of conversation to be deleted. + +This operation is irreversible. Deleted conversations cannot be recovered. All messages in the conversation will be removed from the user's view. + + ```dart @@ -51,3 +81,16 @@ The `deleteConversation()` method takes the following parameters: | ---------------- | --------------------------------------------------------------------------------- | -------- | | conversationWith | `UID` of the user or `GUID` of the group whose conversation you want to delete. | YES | | conversationType | The type of conversation you want to delete . It can be either `user` or `group`. | YES | + +--- + +## Next Steps + + + + Fetch and filter conversation lists + + + Listen for incoming messages in real-time + + diff --git a/sdk/flutter/delete-group.mdx b/sdk/flutter/delete-group.mdx index 2bc36f2e0..6c0194290 100644 --- a/sdk/flutter/delete-group.mdx +++ b/sdk/flutter/delete-group.mdx @@ -1,11 +1,39 @@ --- title: "Delete A Group" +description: "Learn how to permanently delete a group in CometChat using the Flutter SDK. Only group admins can delete groups." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Delete a group (admin only) +String guid = "GROUP_ID"; + +await CometChat.deleteGroup(guid, + onSuccess: (String message) { + debugPrint("Deleted: $message"); + }, + onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); + }, +); +``` + + +Only group admins can delete a group. Deleting a group removes all messages, members, and associated data permanently. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + ## Delete Group + +This operation is irreversible. Deleted groups cannot be recovered. All messages and member data will be permanently lost. + + To delete a group you need to use the `deleteGroup()` method. The user must be an **Admin** of the group they are trying to delete. @@ -29,3 +57,16 @@ The `deleteGroup()` method takes the following parameters: | Parameter | Description | | --------- | ---------------------------------------------- | | `GUID` | The GUID of the group you would like to delete | + +--- + +## Next Steps + + + + Create new public, private, or password-protected groups + + + Leave groups without deleting them + + diff --git a/sdk/flutter/delete-message.mdx b/sdk/flutter/delete-message.mdx index ebf63f117..d868a5452 100644 --- a/sdk/flutter/delete-message.mdx +++ b/sdk/flutter/delete-message.mdx @@ -1,14 +1,46 @@ --- title: "Delete A Message" +description: "Learn how to delete messages and handle real-time deletion events in your Flutter app using CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Delete a message by ID +int messageId = 1234; +await CometChat.deleteMessage(messageId, + onSuccess: (BaseMessage message) { + debugPrint("Message deleted at: ${message.deletedAt}"); + }, + onError: (CometChatException e) { + debugPrint("Delete failed: ${e.message}"); + } +); + +// Listen for deleted messages +CometChat.addMessageListener("listener_id", MessageListener( + onMessageDeleted: (BaseMessage message) { + debugPrint("Message ${message.id} was deleted"); + } +)); +``` + While [deleting a message](/sdk/flutter/delete-message#delete-a-message) is straightforward, receiving events for deleted messages with CometChat has two parts: 1. Adding a listener to receive [real-time message deletes](/sdk/flutter/delete-message#real-time-message-delete-events) when your app is running. 2. Calling a method to retrieve [missed message delete events](/sdk/flutter/delete-message#missed-message-delete-events)-me when your app was not running. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + + +This operation is irreversible. Deleted messages cannot be recovered. + + ## Delete a Message *In other words, as a sender, how do I delete a message?* @@ -87,3 +119,16 @@ For the message deleted event, in the `Action` object received, the following fi In order to delete a message, you need to be either the sender of the message or the admin/moderator of the group in which the message was sent. + +--- + +## Next Steps + + + + Modify sent messages before deletion + + + Handle incoming messages in real-time + + diff --git a/sdk/flutter/delivery-read-receipts.mdx b/sdk/flutter/delivery-read-receipts.mdx index 1d1716d1e..66b2b9bd6 100644 --- a/sdk/flutter/delivery-read-receipts.mdx +++ b/sdk/flutter/delivery-read-receipts.mdx @@ -1,8 +1,43 @@ --- title: "Delivery & Read Receipts" +description: "Track message delivery and read status to provide users with real-time feedback on their sent messages." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Mark message as delivered +CometChat.markAsDelivered(message, onSuccess: (String unused) { + debugPrint("Marked as delivered"); +}, onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); +}); + +// Mark message as read +CometChat.markAsRead(message, onSuccess: (String unused) { + debugPrint("Marked as read"); +}, onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); +}); + +// Listen for receipts +CometChat.addMessageListener("receipts_listener", MessageListener( + onMessagesDelivered: (MessageReceipt receipt) { }, + onMessagesRead: (MessageReceipt receipt) { }, +)); + +// Remove listener when done +CometChat.removeMessageListener("receipts_listener"); +``` + + +Delivery and read receipts allow you to track when messages have been delivered to and read by recipients, providing real-time feedback on message status. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + ## Mark Messages as Delivered @@ -171,6 +206,18 @@ void onMessagesReadByAll(MessageReceipt messageReceipt) { + +Always remove listeners when they're no longer needed (e.g., in the `dispose()` method). Failing to remove listeners can cause memory leaks and duplicate event handling. + +```dart +@override +void dispose() { + CometChat.removeMessageListener("listenerId"); + super.dispose(); +} +``` + + You will receive events in the form of `MessageReceipt` objects. The message receipt contains the following parameters: | Parameter | Information | @@ -228,3 +275,16 @@ The following features will be available only if the **Enhanced Messaging Status * `markAsUnread` method. + +--- + +## Next Steps + + + + Handle incoming messages in real-time + + + Show when users are typing + + diff --git a/sdk/flutter/direct-call.mdx b/sdk/flutter/direct-call.mdx index 5b55bf4e9..09b2f957c 100644 --- a/sdk/flutter/direct-call.mdx +++ b/sdk/flutter/direct-call.mdx @@ -1,11 +1,49 @@ --- title: "Call Session" +description: "Learn how to start and manage direct call sessions in your Flutter application using the CometChat Calls SDK, including token generation, call settings, and session control." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// Generate call token +String sessionId = "SESSION_ID"; +String userAuthToken = await CometChat.getUserAuthToken(); + +CometChatCalls.generateToken(sessionId, userAuthToken, + onSuccess: (GenerateToken token) { + // Start call session + CallSettings callSettings = (CallSettingsBuilder() + ..defaultLayout = true + ..setAudioOnlyCall = false + ).build(); + + CometChatCalls.startSession(token.token!, callSettings, + onSuccess: (Widget? callingWidget) => debugPrint("Session started"), + onError: (CometChatCallsException e) => debugPrint("Error: ${e.message}"), + ); + }, + onError: (CometChatCallsException e) => debugPrint("Error: ${e.message}"), +); + +// End session +CometChatCalls.endSession( + onSuccess: (success) => debugPrint("Session ended"), + onError: (e) => debugPrint("Error: $e"), +); +``` + + ## Overview This section demonstrates how to start a call session in a Flutter application. Previously known as **Direct Calling**. + +**Available via:** SDK | [UI Kits](/ui-kit/flutter/overview) + + Before you begin, we strongly recommend you read the [calling setup guide](/sdk/flutter/calling-setup). @@ -101,6 +139,10 @@ Configure the call experience using the following `CallSettingsBuilder` properti The `CometChatCallsEventsListener` provides real-time callbacks for call session events, including participant changes, call state updates, and error conditions. + +Always remove call listeners when they're no longer needed (e.g., on widget dispose or screen navigation). Failing to remove listeners can cause memory leaks and duplicate event handling. + + Each listener requires a unique `listenerId` string. This ID is used to: - **Prevent duplicate registrations** — Re-registering with the same ID replaces the existing listener - **Enable targeted removal** — Remove specific listeners without affecting others @@ -456,3 +498,16 @@ CometChatCalls.endSession( }, ); ``` + +--- + +## Next Steps + + + + Implement ringing calls with accept/reject functionality + + + Record audio and video calls + + diff --git a/sdk/flutter/edit-message.mdx b/sdk/flutter/edit-message.mdx index 76ae225c6..154cd0122 100644 --- a/sdk/flutter/edit-message.mdx +++ b/sdk/flutter/edit-message.mdx @@ -1,8 +1,44 @@ --- title: "Edit A Message" +sidebarTitle: "Edit Message" +description: "Learn how to edit sent messages and receive real-time edit events in your Flutter app using CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Edit a text message +TextMessage updatedMessage = TextMessage( + text: "Updated message text", + receiverUid: "receiver_uid", + receiverType: CometChatReceiverType.user, + type: CometChatMessageType.text +); +updatedMessage.id = originalMessageId; + +await CometChat.editMessage(updatedMessage, + onSuccess: (BaseMessage message) { + debugPrint("Message edited: $message"); + }, + onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); + } +); + +// Listen for edit events +CometChat.addMessageListener("listener_id", MessageListener( + onMessageEdited: (BaseMessage message) { + debugPrint("Message was edited: ${message.id}"); + } +)); +``` + + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + While editing a message is straightforward, receiving events for edited messages with CometChat has two parts: @@ -110,3 +146,22 @@ For the message edited event, in the `Action` object received, the following fie In order to edit a message, you need to be either the sender of the message or the admin/moderator of the group in which the message was sent. + +--- + +## Next Steps + + + + Learn how to delete messages from conversations + + + Send text, media, and custom messages + + + Handle incoming messages in real-time + + + Create and manage message threads + + diff --git a/sdk/flutter/extensions-overview.mdx b/sdk/flutter/extensions-overview.mdx index 29c1774bd..1c98c1221 100644 --- a/sdk/flutter/extensions-overview.mdx +++ b/sdk/flutter/extensions-overview.mdx @@ -1,4 +1,147 @@ --- title: "Extensions" +sidebarTitle: "Extensions" +description: "Explore CometChat extensions that add enhanced functionality to your Flutter chat application" url: "/fundamentals/extensions-overview" ---- \ No newline at end of file +--- + +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +**What are Extensions?** +Extensions are add-on features that extend CometChat's core functionality beyond basic messaging. + +**How to Enable:** +1. Go to [CometChat Dashboard](https://app.cometchat.com) +2. Navigate to your App → Extensions +3. Enable desired extensions +4. Extensions activate automatically on SDK initialization + +**Extension Categories:** +- **User Experience** → Pin message, Link preview, Thumbnails, Voice transcription +- **User Engagement** → Polls, Reactions, Mentions, Message translation, Stickers +- **Collaboration** → Whiteboard, Collaborative documents +- **Notifications** → Push, Email, SMS notifications +- **Moderation** → Content filtering, Profanity detection +- **Security** → Disappearing messages, End-to-end encryption + +**Full Extension List:** [Extensions Overview](/fundamentals/extensions-overview) + + +Extensions extend CometChat's core functionality, adding enhanced features to your chat application. They help you build a complete chat experience beyond basic voice, video, and text messaging. + +## How Extensions Work + +Extensions are enabled through the CometChat Dashboard and automatically integrate with your Flutter application upon SDK initialization and successful login. Once enabled, extension features become available without additional SDK configuration. + +## Enabling Extensions + + + + Log in to the [CometChat Dashboard](https://app.cometchat.com) and select your application. + + + Go to the Extensions section in your app settings. + + + Toggle on the extensions you want to use in your application. + + + Extensions activate automatically when your Flutter app initializes the CometChat SDK. + + + +## Available Extension Categories + +### User Experience + +Extensions that improve the messaging experience: + +| Extension | Description | +| --- | --- | +| Pin Message | Allow users to pin important messages | +| Link Preview | Automatically generate previews for shared links | +| Rich Media Preview | Enhanced media previews for images and videos | +| Thumbnail Generation | Auto-generate thumbnails for media files | +| Voice Transcription | Convert voice messages to text | +| Save Message | Let users bookmark messages for later | + +### User Engagement + +Extensions that increase user interaction: + +| Extension | Description | +| --- | --- | +| Polls | Create and vote on polls within chats | +| Reactions | Add emoji reactions to messages | +| Mentions | Tag users in messages with @mentions | +| Message Translation | Translate messages to different languages | +| Smart Reply | AI-powered reply suggestions | +| Stickers | Send stickers in conversations | +| Giphy/Tenor | Search and share GIFs | + +### Collaboration + +Extensions for team collaboration: + +| Extension | Description | +| --- | --- | +| Collaborative Whiteboard | Real-time whiteboard for visual collaboration | +| Collaborative Document | Edit documents together in real-time | + +### Notifications + +Extensions for alerting users: + +| Extension | Description | +| --- | --- | +| Push Notifications | Mobile and web push alerts | +| Email Notifications | Email alerts for missed messages | +| SMS Notifications | Text message alerts | + +### Moderation + +Extensions for content safety: + +| Extension | Description | +| --- | --- | +| Profanity Filter | Automatically filter inappropriate content | +| Image Moderation | Detect and filter inappropriate images | +| Data Masking | Mask sensitive information in messages | + +### Security + +Extensions for enhanced security: + +| Extension | Description | +| --- | --- | +| Disappearing Messages | Messages that auto-delete after a set time | +| End-to-End Encryption | Secure message encryption | + +## Extension Support in UI Kit + +If you're using CometChat UI Kit for Flutter, many extensions are automatically supported and rendered in the UI. Extension features will only be available if they are supported by the CometChat UI Kit. + + +For detailed information on each extension, including configuration options and usage, visit the [Extensions Overview](/fundamentals/extensions-overview) in the fundamentals documentation. + + +--- + +## Next Steps + + + + Explore all available SDK resources and documentation + + + Configure webhooks for real-time event notifications + + + Understand API rate limits and quotas + + + Handle real-time events in your application + + diff --git a/sdk/flutter/flag-message.mdx b/sdk/flutter/flag-message.mdx index 02b71550c..425310e84 100644 --- a/sdk/flutter/flag-message.mdx +++ b/sdk/flutter/flag-message.mdx @@ -1,11 +1,47 @@ --- title: "Flag Message" +description: "Learn how to flag and report inappropriate messages for moderation review in your Flutter application using CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// Get available flag reasons +CometChat.getFlagReasons( + onSuccess: (List reasons) { + debugPrint("Flag reasons: $reasons"); + }, + onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); + }, +); + +// Flag a message +FlagDetail flagDetail = FlagDetail() + ..reasonId = "spam" + ..remark = "Optional additional context"; + +CometChat.flagMessage(messageId, flagDetail, + onSuccess: (String response) { + debugPrint("Message flagged: $response"); + }, + onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); + }, +); +``` + + ## Overview Flagging messages allows users to report inappropriate content to moderators or administrators. When a message is flagged, it appears in the [CometChat Dashboard](https://app.cometchat.com) under **Moderation > Flagged Messages** for review. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [Dashboard](https://app.cometchat.com) + + For a complete understanding of how flagged messages are reviewed and managed, see the [Flagged Messages](/moderation/flagged-messages) documentation. @@ -197,3 +233,22 @@ Here's a complete implementation showing how to build a report message flow: ``` + +--- + +## Next Steps + + + + Handle incoming messages and real-time events + + + Remove messages from conversations + + + Automate content moderation with AI + + + Track message delivery and read status + + diff --git a/sdk/flutter/flutter-overview.mdx b/sdk/flutter/flutter-overview.mdx index acc4dc70c..8f27bb8b8 100644 --- a/sdk/flutter/flutter-overview.mdx +++ b/sdk/flutter/flutter-overview.mdx @@ -1,4 +1,39 @@ --- title: "Flutter Chat UI Kit" +description: "Complete guide to integrating CometChat's Flutter SDK for real-time messaging, voice/video calling, and AI features in your Flutter applications." url: "/ui-kit/flutter/overview" ---- \ No newline at end of file +--- + +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +Choose your path: +- **Getting Started** → [Setup](/sdk/flutter/setup) - Install and initialize the SDK +- **Authentication** → [Authentication](/sdk/flutter/authentication-overview) - Login and user management +- **Messaging** → [Messaging Overview](/sdk/flutter/messaging-overview) - Send, receive, edit messages +- **Users** → [Users Overview](/sdk/flutter/users-overview) - User presence, retrieval, blocking +- **Groups** → [Groups Overview](/sdk/flutter/groups-overview) - Create, join, manage groups +- **Calling** → [Calling Overview](/sdk/flutter/calling-overview) - Voice and video calls +- **AI Features** → [AI Agents](/sdk/flutter/ai-agents) - AI-powered chat capabilities +- **Key Concepts** → [Key Concepts](/sdk/flutter/key-concepts) - Core SDK concepts and terminology + + +--- + +## Next Steps + + + + Install and initialize the CometChat Flutter SDK + + + Learn core concepts before building + + + Start sending text and media messages + + + Add real-time calling to your app + + diff --git a/sdk/flutter/group-add-members.mdx b/sdk/flutter/group-add-members.mdx index e125be98b..330e70e5e 100644 --- a/sdk/flutter/group-add-members.mdx +++ b/sdk/flutter/group-add-members.mdx @@ -1,11 +1,38 @@ --- title: "Add Members To A Group" +description: "Learn how to add members to a group in your Flutter app using the CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Add members to a group +List members = [ + GroupMember.fromUid(uid: "user1", scope: CometChatMemberScope.participant, name: "User 1"), + GroupMember.fromUid(uid: "user2", scope: CometChatMemberScope.moderator, name: "User 2"), +]; + +CometChat.addMembersToGroup( + guid: "GROUP_ID", + groupMembers: members, + onSuccess: (Map result) { + debugPrint("Members added: $result"); + }, + onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); + }, +); +``` + ## Add Members to Group + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + You can add members to the group using the `addMembersToGroup()` method. This method takes the below parameters: 1. `GUID` - GUID of the group users are to be added to. @@ -83,3 +110,17 @@ For the group member added event, in the `Action` object received, the following 2. `actionOn` - User object containing the details of the user who was added to the group 3. `actionBy` - User object containing the details of the user who added the member to the group 4. `actionFor` - Group object containing the details of the group to which the member was added + + +--- + +## Next Steps + + + + Get the list of members in a group + + + Remove or ban members from groups + + diff --git a/sdk/flutter/group-change-member-scope.mdx b/sdk/flutter/group-change-member-scope.mdx index 412b54b93..d327cce04 100644 --- a/sdk/flutter/group-change-member-scope.mdx +++ b/sdk/flutter/group-change-member-scope.mdx @@ -1,13 +1,34 @@ --- title: "Change Member Scope" +description: "Learn how to change the scope (role) of group members in CometChat using the Flutter SDK, including admin, moderator, and participant roles." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Change member scope (admin, moderator, participant) +await CometChat.updateGroupMemberScope( + guid: "GROUP_ID", + uid: "USER_ID", + scope: CometChatMemberScope.moderator, + onSuccess: (String message) => debugPrint("Scope updated: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Scopes: CometChatMemberScope.admin, .moderator, .participant +``` + ## Change Scope of a Group Member In order to change the scope of a group member, you can use the `changeGroupMemberScope()`. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ```dart @@ -76,3 +97,16 @@ For the group member scope changed event, in the `Action` object received, the f 4. `actionFor` - Group object containing the details of the group in which the member scope was changed 5. `oldScope` - The original scope of the member 6. `newScope` - The updated scope of the member + +--- + +## Next Steps + + + + Get the list of members in a group + + + Transfer group ownership to another admin + + diff --git a/sdk/flutter/group-kick-member.mdx b/sdk/flutter/group-kick-member.mdx index adaa4c841..1db1718a9 100644 --- a/sdk/flutter/group-kick-member.mdx +++ b/sdk/flutter/group-kick-member.mdx @@ -1,8 +1,38 @@ --- title: "Ban/Kick Member From A Group" +description: "Learn how to kick, ban, and unban members from groups using the CometChat Flutter SDK, including real-time event handling." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Kick a member from group +CometChat.kickGroupMember( + guid: "GROUP_ID", + uid: "USER_ID", + onSuccess: (String message) => debugPrint("Kicked: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Ban a member from group +CometChat.banGroupMember( + guid: "GROUP_ID", + uid: "USER_ID", + onSuccess: (String message) => debugPrint("Banned: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Unban a member +CometChat.unbanGroupMember( + guid: "GROUP_ID", + uid: "USER_ID", + onSuccess: (String message) => debugPrint("Unbanned: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + There are certain actions that can be performed on the group members: @@ -13,6 +43,10 @@ There are certain actions that can be performed on the group members: All of the above actions can only be performed by the **Admin** or the **Moderator** of the group. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ## Kick a Group Member The Admin or Moderator of a group can kick a member out of the group using the `kickGroupMember()` method. @@ -233,3 +267,16 @@ For group member unbanned event, the details can be obtained using the below fie 2. `actionBy` - User object containing the details of the user who has unbanned the member 3. `actionOn` - User object containing the details of the member that has been unbanned 4. `actionFor` - Group object containing the details of the Group from which the member was unbanned + +--- + +## Next Steps + + + + Add new members to your groups + + + Update member roles and permissions + + diff --git a/sdk/flutter/groups-overview.mdx b/sdk/flutter/groups-overview.mdx index 99e877026..ac8de5a5f 100644 --- a/sdk/flutter/groups-overview.mdx +++ b/sdk/flutter/groups-overview.mdx @@ -1,10 +1,47 @@ --- title: "Groups" sidebarTitle: "Overview" +description: "Learn how to create and manage groups in CometChat Flutter SDK, including public, private, and password-protected groups with admin, moderator, and member roles." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +Choose your path: +- **Create Group** → [create-group](/sdk/flutter/create-group) - Create public, private, or password groups +- **Join Group** → [join-group](/sdk/flutter/join-group) - Join existing groups +- **Leave Group** → [leave-group](/sdk/flutter/leave-group) - Leave groups you're a member of +- **Retrieve Groups** → [retrieve-groups](/sdk/flutter/retrieve-groups) - List and fetch groups +- **Retrieve Members** → [retrieve-group-members](/sdk/flutter/retrieve-group-members) - Get group member list +- **Manage Members** → [group-add-members](/sdk/flutter/group-add-members) - Add, remove, manage members +- **Update Group** → [update-group](/sdk/flutter/update-group) - Modify group details +- **Delete Group** → [delete-group](/sdk/flutter/delete-group) - Remove groups permanently + Groups help your users to converse together in a single space. You can have three types of groups- private, public and password protected. Each group includes three kinds of users- admin, moderator, member. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + +--- + +## Next Steps + + + + Create public, private, or password-protected groups + + + List and fetch groups with filtering options + + + Join existing public or password-protected groups + + + Add, remove, and manage group members + + diff --git a/sdk/flutter/interactive-messages.mdx b/sdk/flutter/interactive-messages.mdx index ce85974c3..3b951bb44 100644 --- a/sdk/flutter/interactive-messages.mdx +++ b/sdk/flutter/interactive-messages.mdx @@ -1,11 +1,42 @@ --- title: "Interactive Messages" +description: "Learn how to send and receive interactive messages with embedded forms, buttons, and other interactive elements in your Flutter app using CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Create interactive message with form data +InteractiveMessage interactiveMessage = InteractiveMessage( + interactiveData: interactiveData, // Map with form fields + receiverUid: "USER_UID", + type: "form", + receiverType: "user", + allowSenderInteraction: true, +); + +// Send interactive message +CometChat.sendInteractiveMessage(interactiveMessage, + onSuccess: (InteractiveMessage message) { }, + onError: (CometChatException e) { } +); + +// Mark as interacted +await CometChat.markAsInteracted(messageId, elementId, + onSuccess: (String message) { }, + onError: (CometChatException e) { } +); +``` + An `InteractiveMessage` is a specialized object that encapsulates an interactive unit within a chat message, such as an embedded form that users can fill out directly within the chat interface. This enhances user engagement by making the chat experience more interactive and responsive to user input. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + `InteractiveMessage` is a chat message with embedded interactive content. It can contain various properties: | Parameter | Description | @@ -246,3 +277,22 @@ These event listeners offer your application a way to provide real-time updates ### Usage An `InteractiveMessage` is constructed with the receiver's UID, the receiver type, the interactive type, and interactive data as a JSONObject. Once created, the `InteractiveMessage` can be sent using CometChat's `sendInteractiveMessage()` method. Incoming `InteractiveMessages` can be received and processed via CometChat's message listener framework. + +--- + +## Next Steps + + + + Learn how to send text, media, and custom messages + + + Handle incoming messages in real-time + + + Send ephemeral messages that aren't stored + + + Understand message types and hierarchy + + diff --git a/sdk/flutter/join-group.mdx b/sdk/flutter/join-group.mdx index 41e6b00da..dcc5ad077 100644 --- a/sdk/flutter/join-group.mdx +++ b/sdk/flutter/join-group.mdx @@ -1,13 +1,36 @@ --- title: "Join A Group" +description: "Learn how to join public and password-protected groups using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Join a public group +CometChat.joinGroup("GROUP_GUID", CometChatGroupType.public, + onSuccess: (Group group) => debugPrint("Joined: ${group.name}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Join a password-protected group +CometChat.joinGroup("GROUP_GUID", CometChatGroupType.password, + password: "group_password", + onSuccess: (Group group) => debugPrint("Joined: ${group.name}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + ## Join a Group In order to start participating in group conversations, you will have to join a group. You can do so using the `joinGroup()` method. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ```dart @@ -74,3 +97,16 @@ For the group member joined event, in the `Action` object received, the followin 1. `action` - `joined` 2. `actionBy` - User object containing the details of the user who joined the group 3. `actionFor`- Group object containing the details of the group the user has joined + +--- + +## Next Steps + + + + Leave groups you're a member of + + + Get the list of group members + + diff --git a/sdk/flutter/key-concepts.mdx b/sdk/flutter/key-concepts.mdx index c0c79ebbb..958af6d28 100644 --- a/sdk/flutter/key-concepts.mdx +++ b/sdk/flutter/key-concepts.mdx @@ -1,8 +1,38 @@ --- title: "Key Concepts" +description: "Essential concepts and terminology for understanding the CometChat Flutter SDK including users, groups, messaging, and authentication." --- - +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// Key identifiers +String uid = "user_123"; // Unique User Identifier +String guid = "group_456"; // Group Unique Identifier + +// Receiver types +CometChatReceiverType.user // For 1-on-1 messages +CometChatReceiverType.group // For group messages + +// Message categories +CometChatMessageCategory.message // text, image, video, audio, file +CometChatMessageCategory.custom // Custom data messages +CometChatMessageCategory.action // System-generated messages +CometChatMessageCategory.call // Call-related messages + +// Group types +CometChatGroupType.public // Anyone can join +CometChatGroupType.password // Requires password to join +CometChatGroupType.private // Invite-only + +// Member scopes +CometChatMemberScope.admin // Full privileges +CometChatMemberScope.moderator // Moderate members +CometChatMemberScope.participant // Send/receive messages +``` + ### CometChat Dashboard @@ -150,3 +180,22 @@ Know more about manual mode connection [click here](/sdk/flutter/connection-beha | ----------------- | ------------------------------------------------------------------------------------------------------------------ | | App in foreground | Call `CometChat.connect()` to create the WebSocket connection | | App in background | Disconnect the WebSocket connection if no ping is received within 30 seconds after the app goes in the background. | + +--- + +## Next Steps + + + + Install and initialize the CometChat Flutter SDK + + + Start sending text, media, and custom messages + + + Learn about user login and auth tokens + + + Understand message categories and types + + diff --git a/sdk/flutter/leave-group.mdx b/sdk/flutter/leave-group.mdx index f73638b8d..66b0113e9 100644 --- a/sdk/flutter/leave-group.mdx +++ b/sdk/flutter/leave-group.mdx @@ -1,13 +1,42 @@ --- title: "Leave A Group" +description: "Learn how to leave a group and stop receiving updates and messages from that group using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Leave a group +String GUID = "GROUP_ID"; + +CometChat.leaveGroup(GUID, + onSuccess: (String message) { + debugPrint("Left group: $message"); + }, + onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); + } +); + +// Listen for group member left events +CometChat.addGroupListener("listener_id", GroupListener( + onGroupMemberLeft: (Action action, User leftUser, Group leftGroup) { + debugPrint("${leftUser.name} left ${leftGroup.name}"); + }, +)); +``` + ## Leave a Group In order to stop receiving updates and messages for any particular joined group, you will have to leave the group using the `leaveGroup()` method. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ```dart @@ -65,3 +94,16 @@ For the group member left event, in the `Action` object received, the following 1. `action` - `left` 2. `actionBy` - User object containing the details of the user who left the group 3. `actionFor` - Group object containing the details of the group the user has left + +--- + +## Next Steps + + + + Join existing public or password-protected groups + + + Permanently delete a group (admin only) + + diff --git a/sdk/flutter/login-listeners.mdx b/sdk/flutter/login-listeners.mdx index 7d720a796..fce302df9 100644 --- a/sdk/flutter/login-listeners.mdx +++ b/sdk/flutter/login-listeners.mdx @@ -1,8 +1,43 @@ --- title: "Login Listeners" +description: "Learn how to listen for real-time login and logout events using CometChat's LoginListener in your Flutter application." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Add login listener +CometChat.addLoginListener("UNIQUE_LISTENER_ID", LoginListenerClass()); + +// Implement LoginListener mixin +class LoginListenerClass with LoginListener { + @override + void loginSuccess(User user) { + debugPrint("Login success: ${user.name}"); + } + + @override + void loginFailure(CometChatException e) { + debugPrint("Login failed: ${e.message}"); + } + + @override + void logoutSuccess() { + debugPrint("Logout success"); + } + + @override + void logoutFailure(CometChatException e) { + debugPrint("Logout failed: ${e.message}"); + } +} + +// Remove listener when done +CometChat.removeLoginListener("UNIQUE_LISTENER_ID"); +``` + The CometChat SDK provides you with real-time updates for the `login` and `logout` events. This can be achieved using the `LoginListener` class provided. LoginListener consists of 4 events that can be triggered. These are as follows: @@ -52,6 +87,10 @@ void loginFailure(CometChatException e) { In order to stop receiving events related to login and logout you need to use the `removeLoginListener()` method provided by the SDK and pas the ID of the listener that needs to be removed. + +Always remove login listeners when they're no longer needed (e.g., on widget disposal or when navigating away). Failing to remove listeners can cause memory leaks and duplicate event handling. + + ```dart @@ -61,3 +100,16 @@ CometChat.removeLoginListener("UNIQUE_LISTENER_ID"); + +--- + +## Next Steps + + + + Learn about login methods and authentication flows + + + Explore all available real-time event listeners + + diff --git a/sdk/flutter/mentions.mdx b/sdk/flutter/mentions.mdx index 2a0ad288e..52b9034b4 100644 --- a/sdk/flutter/mentions.mdx +++ b/sdk/flutter/mentions.mdx @@ -1,13 +1,41 @@ --- title: "Mentions" +description: "Learn how to mention users in messages to notify and engage specific individuals in conversations using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Send message with user mention +String messageText = "Hello, <@uid:cometchat-uid-1>"; +TextMessage textMessage = TextMessage( + text: messageText, + receiverUid: "UID", + receiverType: CometChatReceiverType.user, + type: CometChatMessageType.text, +); +CometChat.sendMessage(textMessage, onSuccess: (msg) { + print("Mentioned users: ${msg.mentionedUsers}"); +}, onError: (e) {}); + +// Check if logged-in user was mentioned +bool wasMentioned = message.hasMentionedMe; + +// Get all mentioned users from a message +List mentionedUsers = message.mentionedUsers; +``` + Mentions are a powerful tool for enhancing communication in messaging platforms. They streamline interaction by allowing users to easily engage and collaborate with particular individuals, especially in group conversations. Mentions in messages enable users to refer to specific individuals within a conversation. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ## Send Mentioned Messages Every User object has a String unique identifier associated with them which can be found in a property called uid. To mention a user in a message, the message text should contain the uid in following format: `<@uid:UID_OF_THE_USER>`. For example, to mention the user with UID cometchat-uid-1 in a text message, your text should be "`<@uid:cometchat-uid-1>`" @@ -225,3 +253,16 @@ message.hasMentionedMe + +--- + +## Next Steps + + + + Learn how to send text, media, and custom messages + + + Handle incoming messages in real-time + + diff --git a/sdk/flutter/message-structure-and-hierarchy.mdx b/sdk/flutter/message-structure-and-hierarchy.mdx index 97385b653..749ea269c 100644 --- a/sdk/flutter/message-structure-and-hierarchy.mdx +++ b/sdk/flutter/message-structure-and-hierarchy.mdx @@ -1,8 +1,40 @@ --- title: "Message Structure And Hierarchy" +description: "Understand the message categories, types, and class hierarchy in CometChat Flutter SDK including TextMessage, MediaMessage, CustomMessage, and InteractiveMessage." --- - +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// Message Class Hierarchy +BaseMessage (abstract) +├── TextMessage // category: message, type: text +├── MediaMessage // category: message, type: image/video/audio/file +├── CustomMessage // category: custom, type: user-defined +├── InteractiveMessage // category: interactive, type: form/card/scheduler +└── Action // category: action, type: groupMember/message + +// Common BaseMessage Properties +message.id; // int - Unique message ID +message.sender; // User - Message sender +message.receiverUid; // String - Receiver UID or GUID +message.receiverType; // String - "user" or "group" +message.category; // String - message/custom/action/interactive +message.type; // String - text/image/video/audio/file/custom +message.sentAt; // DateTime - When message was sent +message.deliveredAt; // DateTime - When message was delivered +message.readAt; // DateTime - When message was read +message.metadata; // Map - Custom data + +// Type-specific Properties +textMessage.text; // String - Text content +mediaMessage.attachment; // Attachment - File details +customMessage.customData; // Map - Custom payload +interactiveMessage.interactiveData; // Map - Interactive element data +``` + The below diagram helps you better understand the various message categories and types that a CometChat message can belong to. @@ -93,3 +125,22 @@ The call messages have a property called status that helps you figure out the st 5. unanswered - when the call was not answered by the receiver. 6. busy - when the receiver of the call was busy on another call. 7. ended - when the call was successfully completed and ended by either the initiator or receiver. + +--- + +## Next Steps + + + + Learn how to send text, media, and custom messages + + + Handle incoming messages with real-time listeners + + + Create forms, cards, and interactive elements + + + Modify or remove sent messages + + diff --git a/sdk/flutter/messaging-overview.mdx b/sdk/flutter/messaging-overview.mdx index 49e55d1d6..5eba25761 100644 --- a/sdk/flutter/messaging-overview.mdx +++ b/sdk/flutter/messaging-overview.mdx @@ -1,12 +1,44 @@ --- title: "Messaging" sidebarTitle: "Overview" +description: "Overview of CometChat messaging features for Flutter including sending, receiving, editing, and deleting messages, plus advanced features like typing indicators and read receipts." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +Choose your path: +- **Send Messages** → [send-message](/sdk/flutter/send-message) - Text, media, and custom messages +- **Receive Messages** → [receive-messages](/sdk/flutter/receive-messages) - Real-time message listeners +- **Edit Messages** → [edit-message](/sdk/flutter/edit-message) - Modify sent messages +- **Delete Messages** → [delete-message](/sdk/flutter/delete-message) - Remove messages +- **Threaded Messages** → [threaded-messages](/sdk/flutter/threaded-messages) - Message threads and replies +- **Typing Indicators** → [typing-indicators](/sdk/flutter/typing-indicators) - Real-time typing status +- **Read Receipts** → [delivery-read-receipts](/sdk/flutter/delivery-read-receipts) - Delivery and read status + Messaging is one of the core features of CometChat. We've thoughtfully created methods to help you send, receive and fetch message history. At the minimum, you must add code for [sending messages](/sdk/flutter/send-message) message and [receiving messages](/sdk/flutter/receive-messages). Once you've implemented that, you can proceed to more advanced features like [typing indicators](/sdk/flutter/typing-indicators) and [Delivery & Read Receipts](/sdk/flutter/delivery-read-receipts). + +--- + +## Next Steps + + + + Learn how to send text, media, and custom messages + + + Set up real-time message listeners + + + Show when users are typing + + + Track message delivery and read status + + diff --git a/sdk/flutter/overview.mdx b/sdk/flutter/overview.mdx index 7d60a459a..cd7059f8f 100644 --- a/sdk/flutter/overview.mdx +++ b/sdk/flutter/overview.mdx @@ -1,8 +1,46 @@ --- title: "Overview" +description: "Get started with the CometChat Flutter SDK to add real-time chat and calling features to your Flutter application." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Setup Reference** +```yaml +# Install (pubspec.yaml) +cometchat_sdk: ^4.0.33 +``` + +```dart +// Initialize (run once at app start) +AppSettings appSettings = (AppSettingsBuilder() + ..subscriptionType = CometChatSubscriptionType.allUsers + ..region = "REGION" + ..autoEstablishSocketConnection = true +).build(); + +CometChat.init("APP_ID", appSettings, + onSuccess: (msg) => debugPrint("Init success"), + onError: (e) => debugPrint("Init failed: ${e.message}"), +); + +// Login (after init) +CometChat.login("UID", "AUTH_KEY", // Dev only + onSuccess: (user) => debugPrint("Login success"), + onError: (e) => debugPrint("Login failed"), +); +// For production, use Auth Token instead: +// CometChat.loginWithAuthToken("AUTH_TOKEN", onSuccess: ..., onError: ...); +``` + +**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 + + + +`CometChat.init()` must be called before any other SDK method. Calling `login()`, `sendMessage()`, or registering listeners before `init()` will fail. + This guide demonstrates how to add chat to a Flutter application. Before you begin, we strongly recommend you read the [Key Concepts](/sdk/flutter/key-concepts) guide. @@ -196,3 +234,22 @@ await CometChat.login(UID, authKey, We recommend you call the CometChat `login()` method once your user logs into your app. The `login()` method needs to be called only once. + +--- + +## Next Steps + + + + Detailed installation and configuration options + + + Understand core CometChat concepts and terminology + + + Learn about Auth Keys vs Auth Tokens for production + + + Start sending text, media, and custom messages + + diff --git a/sdk/flutter/presenter-mode.mdx b/sdk/flutter/presenter-mode.mdx index 88887cb43..5b3d2c968 100644 --- a/sdk/flutter/presenter-mode.mdx +++ b/sdk/flutter/presenter-mode.mdx @@ -1,8 +1,35 @@ --- title: "Presenter Mode" +description: "Learn how to implement presenter mode in your Flutter app for webinars, online classes, and broadcast-style calling experiences with CometChat." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Join as presenter +String callToken = "GENERATED_TOKEN"; + +PresentationSettings settings = (PresentationSettingsBuilder() + ..enableDefaultLayout = true + ..isPresenter = true // true = presenter, false = viewer + ..listener = this +).build(); + +CometChatCalls.joinPresentation(callToken, settings, + onSuccess: (Widget? widget) => debugPrint("Joined"), + onError: (e) => debugPrint("Error: $e") +); + +// Join as viewer (audience) +PresentationSettings viewerSettings = (PresentationSettingsBuilder() + ..enableDefaultLayout = true + ..isPresenter = false // Viewer mode + ..listener = this +).build(); +``` + ## Overview @@ -104,3 +131,23 @@ The options available for customization of calls are: In case you wish to achieve a completely customised UI for the Calling experience, you can do so by embedding default android buttons to the screen as per your requirement and then use the below methods to achieve different functionalities for the embedded buttons. For the use case where you wish to align your own custom buttons and not use the default layout provided by CometChat you can embed the buttons in your layout and use the below methods to perform the corresponding operations: + + +--- + +## Next Steps + + + + Implement direct peer-to-peer calling without ringing + + + Customize video rendering and display options + + + Record your presentation sessions + + + Configure session timeout settings for calls + + diff --git a/sdk/flutter/rate-limits.mdx b/sdk/flutter/rate-limits.mdx index 17581b144..8ab340866 100644 --- a/sdk/flutter/rate-limits.mdx +++ b/sdk/flutter/rate-limits.mdx @@ -1,8 +1,29 @@ --- title: "Rate Limits" +description: "Understand CometChat API rate limits and how to handle rate limiting in your Flutter application." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +**Rate Limits:** +- **Core Operations:** 10,000 requests/minute (login, create/delete user, create/join group) +- **Standard Operations:** 20,000 requests/minute (all other operations) + +**When Rate Limited (HTTP 429):** +```dart +// Check response headers for retry timing +// Retry-After: 15 (seconds to wait) +// X-Rate-Limit-Reset: 1625143246 (Unix timestamp) + +// Monitor current limits via headers: +// X-Rate-Limit: 700 (total limit) +// X-Rate-Limit-Remaining: 699 (remaining requests) +``` + +**Best Practice:** Implement exponential backoff when receiving 429 responses. + ### CometChat REST API Rate Limits @@ -32,3 +53,16 @@ However, we do provide the following response headers that you can use to confir `X-Rate-Limit: 700` `X-Rate-Limit-Remaining: 699` + +--- + +## Next Steps + + + + Explore additional SDK resources and documentation + + + Get started with CometChat Flutter SDK setup + + diff --git a/sdk/flutter/reactions.mdx b/sdk/flutter/reactions.mdx index 86824cf6c..5acd675cb 100644 --- a/sdk/flutter/reactions.mdx +++ b/sdk/flutter/reactions.mdx @@ -1,11 +1,38 @@ --- title: "Reactions" +description: "Add, remove, and fetch emoji reactions on messages in your Flutter chat application using CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Add a reaction to a message +CometChat.addReaction(messageId, "😀", onSuccess: (message) { + debugPrint("Reaction added: ${message.getReactions().last}"); +}, onError: (e) {}); + +// Remove a reaction from a message +CometChat.removeReaction(messageId, "😀", onSuccess: (message) { + debugPrint("Reaction removed"); +}, onError: (e) {}); + +// Fetch reactions for a message +ReactionRequest request = (ReactionRequestBuilder() + ..messageId = messageId + ..limit = 30 +).build(); +request.fetchNext(onSuccess: (reactions) {}, onError: (e) {}); +``` + Enhance user engagement in your chat application with message reactions. Users can express their emotions using reactions to messages. This feature allows users to add or remove reactions, and to fetch all reactions on a message. You can also listen to reaction events in real-time. Let's see how to work with reactions in CometChat's Flutter SDK. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ## Add a Reaction Users can add a reaction to a message by calling `addReaction` with the message ID and the reaction emoji. @@ -211,3 +238,22 @@ BaseMessage modifiedBaseMessage = await CometChatHelper.updateMessageWithReactio + +--- + +## Next Steps + + + + Learn how to send text, media, and custom messages + + + Handle incoming messages in real-time + + + Create and manage message threads + + + Mention users and groups in messages + + diff --git a/sdk/flutter/real-time-listeners.mdx b/sdk/flutter/real-time-listeners.mdx index e1685bb8e..6d59eb976 100644 --- a/sdk/flutter/real-time-listeners.mdx +++ b/sdk/flutter/real-time-listeners.mdx @@ -1,8 +1,56 @@ --- title: "All Real Time Listeners" +sidebarTitle: "Real-Time Listeners" +description: "Learn how to register and manage real-time event listeners for messages, users, and groups in the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Message Listener - receive messages in real-time +CometChat.addMessageListener("message_listener", MessageListener( + onTextMessageReceived: (TextMessage message) { + debugPrint("Text received: ${message.text}"); + }, + onMediaMessageReceived: (MediaMessage message) { + debugPrint("Media received: ${message.attachment?.fileUrl}"); + }, +)); + +// User Listener - track user online/offline status +CometChat.addUserListener("user_listener", UserListener( + onUserOnline: (User user) { + debugPrint("${user.name} is online"); + }, + onUserOffline: (User user) { + debugPrint("${user.name} is offline"); + }, +)); + +// Group Listener - track group membership changes +CometChat.addGroupListener("group_listener", GroupListener( + onGroupMemberJoined: (action, joinedUser, joinedGroup) { + debugPrint("${joinedUser.name} joined ${joinedGroup.name}"); + }, + onGroupMemberLeft: (action, leftUser, leftGroup) { + debugPrint("${leftUser.name} left ${leftGroup.name}"); + }, +)); + +// Remove listeners when no longer needed +CometChat.removeMessageListener("message_listener"); +CometChat.removeUserListener("user_listener"); +CometChat.removeGroupListener("group_listener"); +``` + + +CometChat provides real-time event listeners to keep your app updated with live changes. These listeners notify your app when messages are received, users come online/offline, or group membership changes occur. + + +**Listener Cleanup Required:** Always remove 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. + CometChat provides 4 listeners viz. @@ -247,3 +295,30 @@ class Class_Name with MessageListener { where `UNIQUE_LISTENER_ID` is the unique identifier for the listener. Please make sure that no two listeners are added with the same listener id as this could lead to unexpected behavior resulting in loss of events. Once the activity/fragment where the `MessageListener` is declared is not in use, you need to remove the listener using the `removeMessageListener()` method which takes the id of the listener to be removed as the parameter. We suggest you call this method in the `onPause()` method of the activity/fragment. + + + +```dart +CometChat.removeMessageListener(UNIQUE_LISTENER_ID) +``` + + + +--- + +## Next Steps + + + + Handle incoming messages in real-time using message listeners + + + Track when users come online or go offline + + + Show real-time typing status in conversations + + + Track message delivery and read status + + diff --git a/sdk/flutter/receive-messages.mdx b/sdk/flutter/receive-messages.mdx index 92246df7f..e94b62854 100644 --- a/sdk/flutter/receive-messages.mdx +++ b/sdk/flutter/receive-messages.mdx @@ -1,14 +1,54 @@ --- title: "Receive A Message" +sidebarTitle: "Receive Messages" +description: "Learn how to receive real-time messages and fetch missed or historical messages using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Add message listener for real-time messages +CometChat.addMessageListener("UNIQUE_LISTENER_ID", MessageListener( + onTextMessageReceived: (TextMessage message) { + debugPrint("Text message: ${message.text}"); + }, + onMediaMessageReceived: (MediaMessage message) { + debugPrint("Media message: ${message.attachment?.fileUrl}"); + }, +)); + +// Fetch missed messages (after last delivered message) +int lastMessageId = await CometChat.getLastDeliveredMessageId() ?? 0; +MessagesRequest request = (MessagesRequestBuilder() + ..uid = "USER_UID" + ..messageId = lastMessageId + ..limit = 50 +).build(); +List messages = await request.fetchNext(); + +// Fetch message history +MessagesRequest historyRequest = (MessagesRequestBuilder() + ..uid = "USER_UID" + ..limit = 30 +).build(); +List history = await historyRequest.fetchPrevious(); + +// Remove listener when done +CometChat.removeMessageListener("UNIQUE_LISTENER_ID"); +``` + Receiving messages with CometChat has two parts: 1. Adding a listener to receive [Real-time Messages](/sdk/flutter/receive-messages#real-time-messages) when your app is running 2. Calling a method to retrieve [Missed Messages](/sdk/flutter/receive-messages#missed-messages) when your app was not running + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ## Real-time Messages *In other words, as a recipient, how do I receive messages when my app is running?* @@ -57,6 +97,10 @@ onInteractiveMessageReceived(InteractiveMessage message) { We recommend you remove the listener once the activity or fragment is not in use. Typically, this can be added in the `dispose()` method. + +Always remove message listeners when they're no longer needed (e.g., in the `dispose()` method of your StatefulWidget). Failing to remove listeners can cause memory leaks and duplicate event handling. + + ```dart @@ -639,3 +683,22 @@ CometChat.getUnreadMessageCountForAllGroups(hideMessagesFromBlockedUsers: hideMe In the `onSuccess()` callback, you will receive a `Map` which will contain the `GUIDs` of the groups as the key and the unread message counts as the values. + +--- + +## Next Steps + + + + Track when messages are delivered and read by recipients + + + Show real-time typing status in conversations + + + Allow users to edit previously sent messages + + + Remove messages from conversations + + diff --git a/sdk/flutter/recording.mdx b/sdk/flutter/recording.mdx index 54935f250..67bf1d322 100644 --- a/sdk/flutter/recording.mdx +++ b/sdk/flutter/recording.mdx @@ -1,11 +1,42 @@ --- title: "Recording" +description: "Learn how to implement call recording for voice and video calls in your Flutter application using the CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Enable recording button in call settings +CallSettings callSettings = (CallSettingsBuilder() + ..showCallRecordButton = true + ..startRecordingOnCallStart = false // Optional: auto-start recording + ..listener = this +).build(); + +// Start recording manually +CometChatCalls.startRecording(onSuccess: (success) { + debugPrint("Recording started"); +}, onError: (error) { + debugPrint("Error: $error"); +}); + +// Stop recording +CometChatCalls.stopRecording(onSuccess: (success) { + debugPrint("Recording stopped"); +}, onError: (error) { + debugPrint("Error: $error"); +}); +``` + This section will guide you to implement call recording feature for the voice and video calls. + +**Available via:** SDK | [Dashboard](https://app.cometchat.com) + + ## Implementation Once you have decided to implement [Default Calling](/sdk/flutter/default-call) or [Direct Calling](/sdk/flutter/direct-call) calling and followed the steps to implement them. Just few additional listeners and methods will help you quickly implement call recording in your app. @@ -80,3 +111,16 @@ debugPrint("Error $error"); + +--- + +## Next Steps + + + + Implement voice and video calls with ringing functionality + + + Retrieve and manage call history in your app + + diff --git a/sdk/flutter/resources-overview.mdx b/sdk/flutter/resources-overview.mdx index ef8fe0d02..2fb4807f0 100644 --- a/sdk/flutter/resources-overview.mdx +++ b/sdk/flutter/resources-overview.mdx @@ -1,10 +1,33 @@ --- title: "Resources" sidebarTitle: "Overview" +description: "Access rate limits, extensions, webhooks, and other resources for the CometChat Flutter SDK" --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +Choose your resource: +- **Rate Limits** → [rate-limits](/sdk/flutter/rate-limits) - API rate limits and quotas +- **Extensions** → [extensions-overview](/sdk/flutter/extensions-overview) - Available extensions +- **Webhooks** → [webhooks-overview](/sdk/flutter/webhooks-overview) - Webhook configuration +- **Real-Time Listeners** → [real-time-listeners](/sdk/flutter/real-time-listeners) - All listener types + We have a number of resources that will help you while integrating CometChat in your app. You can begin with the [all real-time listeners](/sdk/flutter/real-time-listeners) guide. + +--- + +## Next Steps + + + + Understand API rate limits and quotas + + + Explore available extensions for your app + + diff --git a/sdk/flutter/retrieve-conversations.mdx b/sdk/flutter/retrieve-conversations.mdx index 7008851cc..d70cc57b9 100644 --- a/sdk/flutter/retrieve-conversations.mdx +++ b/sdk/flutter/retrieve-conversations.mdx @@ -1,11 +1,42 @@ --- title: "Retrieve Conversations" +description: "Learn how to retrieve, filter, and manage conversation lists in your Flutter app using the CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// Retrieve conversations with pagination +ConversationsRequest request = (ConversationsRequestBuilder() + ..limit = 30 + ..conversationType = CometChatConversationType.user +).build(); + +await request.fetchNext( + onSuccess: (List conversations) { + for (Conversation conv in conversations) { + debugPrint("Conversation: ${conv.conversationId}"); + } + }, + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +// Get single conversation +CometChat.getConversation("user_uid", "user", + onSuccess: (Conversation conv) => debugPrint("Got: ${conv.conversationId}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + ## Retrieve List of Conversations + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + *In other words, as a logged-in user, how do I retrieve the latest conversations that I've been a part of?* To fetch the list of conversations, you can use the `ConversationsRequest` class. To use this class i.e. to create an object of the `ConversationsRequest` class, you need to use the `ConversationsRequestBuilder` class. The `ConversationsRequestBuilder` class allows you to set the parameters based on which the conversations are to be fetched. @@ -312,3 +343,22 @@ Conversation conversation = CometChat.getConversationFromMessage(message); While converting `Message` object to `Conversation` object, the `unreadMessageCount` & `tags` will not be available in the `Conversation` object. The unread message count needs to be managed in your client-side code. + +--- + +## Next Steps + + + + Remove conversations from the list + + + Show when users are typing + + + Track message delivery and read status + + + Listen for incoming messages in real-time + + diff --git a/sdk/flutter/retrieve-group-members.mdx b/sdk/flutter/retrieve-group-members.mdx index 518ba2801..8384e8b2a 100644 --- a/sdk/flutter/retrieve-group-members.mdx +++ b/sdk/flutter/retrieve-group-members.mdx @@ -1,12 +1,44 @@ --- title: "Retrieve Group Members" +description: "Learn how to fetch and paginate through group members using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Retrieve group members with pagination +GroupMembersRequest request = (GroupMembersRequestBuilder("GROUP_ID") + ..limit = 30 +).build(); + +await request.fetchNext( + onSuccess: (List members) { + for (GroupMember member in members) { + debugPrint("Member: ${member.name}, Scope: ${member.scope}"); + } + }, + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Filter by scope (admin, moderator, participant) +GroupMembersRequest scopedRequest = (GroupMembersRequestBuilder("GROUP_ID") + ..limit = 30 + ..scopes = ["admin", "moderator"] +).build(); +``` + ## Retrieve the List of Group Members -In order to fetch the list of groups members for a group, you can use the `GroupMembersRequest` class. To use this class i.e to create an object of the `GroupMembersRequest` class, you need to use the `GroupMembersRequestBuilder` class. The `GroupMembersRequestBuilder` class allows you to set the parameters based on which the groups are to be fetched. +In order to fetch the list of groups members for a group, you can use the `GroupMembersRequest` class. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + +To use this class i.e to create an object of the `GroupMembersRequest` class, you need to use the `GroupMembersRequestBuilder` class. The `GroupMembersRequestBuilder` class allows you to set the parameters based on which the groups are to be fetched. The `GroupMembersRequestBuilder` class allows you to set the below parameters: @@ -90,3 +122,16 @@ groupMembersRequest.fetchNext(onSuccess: (List groupMemberList){ + +--- + +## Next Steps + + + + Add new members to your groups + + + Remove or ban members from groups + + diff --git a/sdk/flutter/retrieve-groups.mdx b/sdk/flutter/retrieve-groups.mdx index 23417e0b0..2f310bdf6 100644 --- a/sdk/flutter/retrieve-groups.mdx +++ b/sdk/flutter/retrieve-groups.mdx @@ -1,8 +1,42 @@ --- title: "Retrieve Groups" +description: "Learn how to retrieve groups and group details in your Flutter application using the CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Retrieve groups with pagination +GroupsRequest request = (GroupsRequestBuilder() + ..limit = 30 + ..searchKeyword = "search_term" +).build(); + +await request.fetchNext( + onSuccess: (List groups) { + for (Group group in groups) { + debugPrint("Group: ${group.name}"); + } + }, + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); + +// Get a specific group by GUID +await CometChat.getGroup( + "GROUP_ID", + onSuccess: (Group group) => debugPrint("Group: ${group.name}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + + +Retrieve groups allows you to fetch the list of groups you've joined and groups that are available, as well as get details for a specific group. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + ## Retrieve List of Groups @@ -172,3 +206,17 @@ CometChat.getOnlineGroupMemberCount(guids, This method returns a `Map` with the GUID of the group as the key and the online member count for that group as the value. + + +--- + +## Next Steps + + + + Create new public, private, or password-protected groups + + + Get the list of members in a group + + diff --git a/sdk/flutter/retrieve-users.mdx b/sdk/flutter/retrieve-users.mdx index 4483e77bb..da3bca613 100644 --- a/sdk/flutter/retrieve-users.mdx +++ b/sdk/flutter/retrieve-users.mdx @@ -1,8 +1,42 @@ --- title: "Retrieve Users" +description: "Learn how to retrieve users, fetch user lists with filters, and get user details using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Get logged-in user +User? user = await CometChat.getLoggedInUser(); + +// Fetch list of users +UsersRequest usersRequest = (UsersRequestBuilder()..limit = 50).build(); +usersRequest.fetchNext( + onSuccess: (List userList) => debugPrint("Users: $userList"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}") +); + +// Get specific user by UID +CometChat.getUser("user_uid", + onSuccess: (User user) => debugPrint("User: $user"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}") +); + +// Get online user count +CometChat.getOnlineUserCount( + onSuccess: (int count) => debugPrint("Online: $count"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}") +); +``` + + +Retrieve users allows you to fetch user information including the logged-in user details, lists of users with various filters, and specific user details by UID. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + ## Retrieve Logged In User Details @@ -264,3 +298,22 @@ CometChat.getOnlineUserCount(onSuccess: (int count){ + +--- + +## Next Steps + + + + Monitor and manage real-time user online/offline status + + + Block and unblock users to control interactions + + + Create, update, and delete users programmatically + + + Explore all user-related features and capabilities + + diff --git a/sdk/flutter/send-message.mdx b/sdk/flutter/send-message.mdx index fc2b812b6..305317279 100644 --- a/sdk/flutter/send-message.mdx +++ b/sdk/flutter/send-message.mdx @@ -1,11 +1,48 @@ --- title: "Send A Message" +description: "Learn how to send text, media, and custom messages to users and groups using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Send text message to user +TextMessage textMessage = TextMessage( + text: "Hello!", + receiverUid: "UID", + receiverType: CometChatReceiverType.user, + type: CometChatMessageType.text, +); +CometChat.sendMessage(textMessage, onSuccess: (msg) {}, onError: (e) {}); + +// Send text message to group +TextMessage groupMessage = TextMessage( + text: "Hello group!", + receiverUid: "GUID", + receiverType: CometChatReceiverType.group, + type: CometChatMessageType.text, +); +CometChat.sendMessage(groupMessage, onSuccess: (msg) {}, onError: (e) {}); + +// Send media message (image) +MediaMessage mediaMessage = MediaMessage( + receiverUid: "UID", + receiverType: CometChatReceiverType.user, + type: CometChatMessageType.image, + file: "path/to/image.jpg", +); +CometChat.sendMediaMessage(mediaMessage, onSuccess: (msg) {}, onError: (e) {}); +``` + Using CometChat, you can send three types of messages: + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + 1. A [Text Message](/sdk/flutter/send-message#text-message), the most common and standard message type. 2. A [Media Message](/sdk/flutter/send-message#media-message), for sending photos, videos and files. 3. A [Custom Message](/sdk/flutter/send-message#custom-message), for sending completely custom data using Map structures. @@ -565,3 +602,22 @@ CometChat.sendCustomMessage(customMessage, onSuccess: (CustomMessage message) { It is also possible to send interactive messages from CometChat , to know more [click here](/sdk/flutter/interactive-messages) + +--- + +## Next Steps + + + + Handle incoming messages in real-time + + + Modify sent messages after delivery + + + Send forms, cards, and interactive elements + + + Remove messages from conversations + + diff --git a/sdk/flutter/session-timeout.mdx b/sdk/flutter/session-timeout.mdx index 23470881f..2a37258c1 100644 --- a/sdk/flutter/session-timeout.mdx +++ b/sdk/flutter/session-timeout.mdx @@ -1,8 +1,31 @@ --- title: "Session Timeout Flow" +description: "Learn how CometChat Calls SDK handles session timeouts for idle participants in call sessions, including automatic termination and user prompts." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Session timeout is automatic - no configuration needed +// Default behavior: +// - After 120 seconds alone: dialog appears +// - After 180 seconds alone: call auto-terminates + +// Handle session timeout in call listeners +CometChatCalls.addCallEventListeners( + "UNIQUE_LISTENER_ID", + CallEventsListener( + onSessionTimeout: () { + debugPrint("Call ended due to session timeout"); + }, + ), +); +``` + +**Default Timing:** 120s warning dialog → 60s countdown → auto-terminate + Available since v4.1.0 @@ -32,3 +55,22 @@ This feature helps manage inactive call sessions and prevents unnecessary resour The `onSessionTimeout` event is triggered when the call automatically terminates due to session timeout, as illustrated in the diagram above. + +--- + +## Next Steps + + + + Implement voice and video calls with ringing functionality + + + Start calls without the ringing flow + + + Retrieve and manage call history + + + Record calls and access recordings + + diff --git a/sdk/flutter/setup.mdx b/sdk/flutter/setup.mdx index 77e8f1402..0d9d8076a 100644 --- a/sdk/flutter/setup.mdx +++ b/sdk/flutter/setup.mdx @@ -1,8 +1,44 @@ --- title: "Setup" +description: "Install and initialize the CometChat Flutter SDK in your application" --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Setup Reference** +```yaml +# Install (pubspec.yaml) +cometchat_sdk: ^4.0.33 +``` + +```dart +// Initialize (run once at app start) +AppSettings appSettings = (AppSettingsBuilder() + ..subscriptionType = CometChatSubscriptionType.allUsers + ..region = "REGION" + ..autoEstablishSocketConnection = true +).build(); + +CometChat.init("APP_ID", appSettings, + onSuccess: (msg) => debugPrint("Init success"), + onError: (e) => debugPrint("Init failed: ${e.message}") +); + +// Login (after init) +CometChat.login("UID", "AUTH_KEY", // Dev only + onSuccess: (user) => debugPrint("Login success"), + onError: (e) => debugPrint("Login 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 + + + +`CometChat.init()` must be called before any other SDK method. Calling `login()`, `sendMessage()`, or registering listeners before `init()` will fail. + ### Get your Application Keys @@ -154,3 +190,16 @@ Know more about manual mode connection [click here](/sdk/flutter/connection-beha | ----------------- | ------------------------------------------------------------------------------------------------------------------ | | App in foreground | Call `CometChat.connect()` to create the WebSocket connection | | App in background | Disconnect the WebSocket connection if no ping is received within 30 seconds after the app goes in the background. | + +--- + +## Next Steps + + + + Learn how to authenticate users with Auth Keys and Auth Tokens + + + Start sending text, media, and custom messages + + diff --git a/sdk/flutter/standalone-calling.mdx b/sdk/flutter/standalone-calling.mdx index cd1352adc..7a0e098e5 100644 --- a/sdk/flutter/standalone-calling.mdx +++ b/sdk/flutter/standalone-calling.mdx @@ -1,7 +1,42 @@ --- title: "Standalone Calling" +description: "Implement video and audio calling using only the CometChat Calls SDK without the Chat SDK for applications that need calling capabilities without full chat infrastructure." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +```dart +// 1. Generate call token (requires user auth token from REST API) +CometChatCalls.generateToken(sessionId, userAuthToken, + onSuccess: (GenerateToken token) { + // Use token.token to start session + }, + onError: (e) {}, +); + +// 2. Configure and start call session +CallSettings callSettings = (CallSettingsBuilder() + ..defaultLayout = true + ..setAudioOnlyCall = false + ..listener = this +).build(); + +CometChatCalls.startSession(generatedToken, callSettings, + onSuccess: (Widget? callingWidget) { + // Display callingWidget in your UI + }, + onError: (e) {}, +); + +// 3. End session +CometChatCalls.endSession(onSuccess: (s) {}, onError: (e) {}); +``` + +**Prerequisites:** [Calls SDK Setup](/sdk/flutter/calling-setup), User Auth Token from [REST API](/rest-api/auth-tokens/create) + + ## Overview This section demonstrates how to implement calling functionality using only the CometChat Calls SDK, without requiring the Chat SDK. This is ideal for applications that need video/audio calling capabilities without the full chat infrastructure. @@ -413,3 +448,23 @@ CometChatCalls.endSession( }, ); ``` + + +--- + +## Next Steps + + + + Set up the CometChat Calls SDK in your Flutter app + + + Implement direct calling with the Chat SDK integration + + + Implement ringing calls with call notifications + + + Record call sessions for later playback + + diff --git a/sdk/flutter/threaded-messages.mdx b/sdk/flutter/threaded-messages.mdx index 330506158..ef23a4f64 100644 --- a/sdk/flutter/threaded-messages.mdx +++ b/sdk/flutter/threaded-messages.mdx @@ -1,10 +1,43 @@ --- title: "Threaded Messages" +description: "Learn how to send, receive, and fetch messages within a thread attached to a parent message in CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Send a message in a thread (attach to parent message) +TextMessage textMessage = TextMessage( + text: "Reply in thread", + receiverUid: "UID", + receiverType: CometChatReceiverType.user, + type: CometChatMessageType.text, +); +textMessage.parentMessageId = 103; // Parent message ID +CometChat.sendMessage(textMessage, onSuccess: (msg) {}, onError: (e) {}); + +// Fetch messages from a thread +MessagesRequest messageRequest = (MessagesRequestBuilder() + ..uid = "UID" + ..parentMessageId = 103 + ..limit = 50).build(); +messageRequest.fetchPrevious(onSuccess: (List list) {}, onError: (e) {}); + +// Exclude threaded messages from main conversation +MessagesRequest request = (MessagesRequestBuilder() + ..uid = "UID" + ..hideReplies = true + ..limit = 50).build(); +``` + Messages that are started from a particular message are called Threaded messages or simply threads. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + Each Thread is attached to a message which is the Parent message for that thread. ## Send Message in a Thread @@ -147,4 +180,23 @@ messageRequest.fetchNext(onSuccess: (List list) { -The above snippet will return messages between the logged in user and `cometchat-uid-1` excluding all the threaded messages belonging to the same conversation. \ No newline at end of file +The above snippet will return messages between the logged in user and `cometchat-uid-1` excluding all the threaded messages belonging to the same conversation. + +--- + +## Next Steps + + + + Learn how to send text, media, and custom messages + + + Handle incoming messages in real-time + + + Add emoji reactions to messages + + + Understand message types and hierarchy + + \ No newline at end of file diff --git a/sdk/flutter/transfer-group-ownership.mdx b/sdk/flutter/transfer-group-ownership.mdx index 5c2b8b668..6435ad099 100644 --- a/sdk/flutter/transfer-group-ownership.mdx +++ b/sdk/flutter/transfer-group-ownership.mdx @@ -1,13 +1,31 @@ --- title: "Transfer Group Ownership" +description: "Learn how to transfer group ownership to another member in your Flutter application using the CometChat SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Transfer group ownership to another member +await CometChat.transferGroupOwnership( + guid: "GROUP_ID", + uid: "NEW_OWNER_UID", + onSuccess: (String message) => debugPrint("Ownership transferred: $message"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + *In other words, as a logged-in user, how do I transfer the ownership of any group if I am the owner of the group?* In order to transfer the ownership of any group, the first condition is that you must be the owner of the group. In case you are the owner of the group, you can use the `transferGroupOwnership()` method provided by the `CometChat` class. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + This will be helpful as the owner is not allowed to leave the group. In case, you as the owner would like to leave the group, you will have to use this method and transfer your ownership first to any other member of the group and only then you will be allowed to leave the group. @@ -27,3 +45,16 @@ CometChat.transferGroupOwnership(guid: GUID,uid: UID, + +--- + +## Next Steps + + + + Update member roles and permissions + + + Permanently delete a group + + diff --git a/sdk/flutter/transient-messages.mdx b/sdk/flutter/transient-messages.mdx index e39b5e46f..a3c91e9ef 100644 --- a/sdk/flutter/transient-messages.mdx +++ b/sdk/flutter/transient-messages.mdx @@ -1,11 +1,40 @@ --- title: "Transient Messages" +description: "Send ephemeral real-time messages that are not stored on the server, perfect for live reactions and typing indicators." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Send transient message (not stored on server) +Map data = {"LIVE_REACTION": "heart"}; +TransientMessage transientMessage = TransientMessage( + receiverId: "UID", + receiverType: CometChatReceiverType.user, + data: data, +); +CometChat.sendTransientMessage(transientMessage, + onSuccess: () => debugPrint("Sent"), + onError: (e) => debugPrint("Error: ${e.message}"), +); + +// Receive transient messages +CometChat.addMessageListener("LISTENER_ID", MessageListener( + onTransientMessageReceived: (TransientMessage message) { + debugPrint("Received: ${message.data}"); + }, +)); +``` + Transient messages are messages that are sent in real-time only and are not saved or tracked anywhere. The receiver of the message will only receive the message if he is online and these messages cannot be retrieved later. + +**Available via:** SDK | UI Kits + + ## Send a Transient Message You can use the `sendTransientMessage()` method to send a transient message to a user or in a group. The receiver will receive this information in the `onTransientMessageReceived()` method of the `MessageListener` class. In order to send the transient message, you need to use the `TransientMessage` class. @@ -63,3 +92,16 @@ The `TransientMessage` class consists of the below parameters: | **receiverId** | Unique Id of the receiver. This can be the Id of the group or the user the transient message is sent to. | | **receiverType** | The type of the receiver - `CometChatReceiverType.user` (user) or `CometChatReceiverType.``group `(group) | | **data** | A Map to provide data. | + +--- + +## Next Steps + + + + Learn how to send persistent text and media messages + + + Show real-time typing status to users + + diff --git a/sdk/flutter/typing-indicators.mdx b/sdk/flutter/typing-indicators.mdx index 9f04279c7..840ee1774 100644 --- a/sdk/flutter/typing-indicators.mdx +++ b/sdk/flutter/typing-indicators.mdx @@ -1,8 +1,35 @@ --- title: "Typing Indicators" +description: "Show real-time typing indicators to let users know when someone is typing a message." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Start typing indicator to user +CometChat.startTyping(receaverUid: "UID", receiverType: CometChatReceiverType.user); + +// Start typing indicator to group +CometChat.startTyping(receaverUid: "GUID", receiverType: CometChatReceiverType.group); + +// Stop typing indicator +CometChat.endTyping(receaverUid: "UID", receiverType: CometChatReceiverType.user); + +// Listen for typing indicators +CometChat.addMessageListener("listenerId", MessageListener( + onTypingStarted: (TypingIndicator typingIndicator) { }, + onTypingEnded: (TypingIndicator typingIndicator) { }, +)); +``` + + +Typing indicators let users know when someone is actively typing a message, creating a more engaging real-time chat experience. + + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + ## Send a Typing Indicator @@ -71,6 +98,10 @@ You can use the `metadata` field of the `TypingIndicator` class to pass addition *In other words, as a recipient, how do I know when someone is typing?* + +Always remove listeners when they're no longer needed (e.g., in the `dispose()` method). Failing to remove listeners can cause memory leaks and duplicate event handling. + + You will receive the typing indicators in the `onTypingStarted()` and the `onTypingEnded()` method of the registered `MessageListener` class. @@ -105,3 +136,16 @@ The `TypingIndicator` class consists of the below parameters: | `receiverId` | `UID` of the receiver. This is the ID of the group or the user the typing indicator is being sent to. | | `receiverType` | This parameter indicates if the typing indicator is to be sent to a user or a group. The possible values are: 1. `CometChatConstants.RECEIVER_TYPE_USER` 2. `CometChatConstants.RECEIVER_TYPE_GROUP` | | `metadata` | A JSONObject to provider additional data | + +--- + +## Next Steps + + + + Handle incoming messages in real-time + + + Track message delivery and read status + + diff --git a/sdk/flutter/update-group.mdx b/sdk/flutter/update-group.mdx index c9353f983..e9441610c 100644 --- a/sdk/flutter/update-group.mdx +++ b/sdk/flutter/update-group.mdx @@ -1,8 +1,25 @@ --- title: "Update A Group" +description: "Learn how to update group details such as name, description, icon, and metadata using the CometChat Flutter SDK." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Update a group +Group group = Group(guid: "GROUP_ID", name: "New Name", type: CometChatGroupType.public); +group.description = "Updated description"; +group.icon = "https://example.com/icon.png"; + +await CometChat.updateGroup( + group: group, + onSuccess: (Group group) => debugPrint("Updated: ${group.name}"), + onError: (CometChatException e) => debugPrint("Error: ${e.message}"), +); +``` + ## Update Group @@ -10,6 +27,10 @@ title: "Update A Group" You can update the existing details of the group using the `updateGroup()` method. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ```dart @@ -41,3 +62,16 @@ This method takes an instance of the `Group` class as a parameter which should c After the successful update of the group, you will receive an instance of `Group` class containing updated information of the group. For more information on the `Group` class, please check [here](/sdk/flutter/create-group#group-class) + +--- + +## Next Steps + + + + List and fetch groups with filtering options + + + Create new public, private, or password-protected groups + + diff --git a/sdk/flutter/upgrading-from-v3-guide.mdx b/sdk/flutter/upgrading-from-v3-guide.mdx index fad427ece..c8a92a80b 100644 --- a/sdk/flutter/upgrading-from-v3-guide.mdx +++ b/sdk/flutter/upgrading-from-v3-guide.mdx @@ -1,8 +1,29 @@ --- title: "Upgrading From V3" +description: "Guide to upgrading your Flutter application from CometChat SDK v3 to v4, including import changes and setup instructions." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +**Key Migration Changes (v3 → v4):** +- **Chat SDK Import:** Replace all v3 imports with single import: + ```dart + import 'package:cometchat_sdk/cometchat_sdk.dart'; + ``` +- **Calling SDK Import:** Replace all v3 imports with single import: + ```dart + import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart'; + ``` +- **Setup:** Follow the updated [Setup Guide](/sdk/flutter/setup) for v4 installation + +**Migration Steps:** +1. Update `pubspec.yaml` with v4 SDK versions +2. Replace all v3 import statements with new unified imports +3. Run `flutter pub get` to install updated dependencies +4. Test your application for any breaking changes + Upgrading from v3.x to v4 is fairly simple. Below are the major changes that are released as a part of CometChat v4: @@ -35,3 +56,22 @@ import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart'; + +--- + +## Next Steps + + + + Complete installation and initialization guide for v4 + + + Understand core SDK concepts and terminology + + + Learn about user authentication in v4 + + + Start sending messages with the v4 SDK + + diff --git a/sdk/flutter/user-management.mdx b/sdk/flutter/user-management.mdx index b58d3da36..99ee37ca8 100644 --- a/sdk/flutter/user-management.mdx +++ b/sdk/flutter/user-management.mdx @@ -1,11 +1,40 @@ --- title: "User Management" +description: "Learn how to create, update, and manage users in CometChat using the Flutter SDK, including user creation, profile updates, and user class properties." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Create a user (requires API Key - use on backend or during development) +User user = User(uid: "user_123", name: "John Doe"); +CometChat.createUser(user, "AUTH_KEY", onSuccess: (User user) { + debugPrint("User created: ${user.name}"); +}, onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); +}); + +// Update logged-in user's profile +User updatedUser = User(name: "New Name"); +updatedUser.avatar = "https://example.com/avatar.png"; +CometChat.updateCurrentUserDetails(updatedUser, onSuccess: (User user) { + debugPrint("User updated: ${user.name}"); +}, onError: (CometChatException e) { + debugPrint("Error: ${e.message}"); +}); +``` + +**Key Points:** Create users via REST API (production) or SDK (development). Update logged-in user with `updateCurrentUserDetails()`. Delete users via REST API only. + When a user logs into your app, you need to programmatically login the user into CometChat. But before you log in the user to CometChat, you need to create the user. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + Summing up- **When a user registers in your app** @@ -100,3 +129,22 @@ Deleting a user can only be achieved via the Restful APIs. For more information | hasBlockedMe | No | A boolean that determines if the user has blocked the logged in user | | blockedByMe | No | A boolean that determines if the logged in user has blocked the user | | tags | Yes | A list of tags to identify specific users | + +--- + +## Next Steps + + + + Fetch and filter users from your CometChat app + + + Learn about login methods and auth tokens + + + Track and display real-time user online status + + + Block and unblock users in your app + + diff --git a/sdk/flutter/user-presence.mdx b/sdk/flutter/user-presence.mdx index a9721a3d9..533bf5ba1 100644 --- a/sdk/flutter/user-presence.mdx +++ b/sdk/flutter/user-presence.mdx @@ -1,11 +1,43 @@ --- title: "User Presence" +description: "Track when users come online or go offline in real-time using CometChat's presence subscription system." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Configure presence subscription during init +AppSettings appSettings = (AppSettingsBuilder() + ..subscriptionType = CometChatSubscriptionType.allUsers // or .roles, .friends + ..region = "REGION" + ..autoEstablishSocketConnection = true +).build(); + +await CometChat.init("APP_ID", appSettings, onSuccess: (msg) {}, onError: (e) {}); + +// Listen for presence changes +CometChat.addUserListener("UNIQUE_LISTENER_ID", UserListener( + onUserOnline: (User user) { + debugPrint("${user.name} is online"); + }, + onUserOffline: (User user) { + debugPrint("${user.name} is offline"); + }, +)); + +// Remove listener when done +CometChat.removeUserListener("UNIQUE_LISTENER_ID"); +``` + User Presence helps us understand if a user is available to chat or not. + +**Available via:** SDK | [REST API](https://api-explorer.cometchat.com) | [UI Kits](/ui-kit/flutter/overview) + + ## Real-time Presence *In other words, as a logged-in user, how do I know if a user is online or offline?* @@ -69,6 +101,10 @@ CometChat.removeUserListener(listenerID); + +Always remove listeners when they're no longer needed (e.g., in the `dispose()` method). Failing to remove listeners can cause memory leaks and duplicate event handling. + + ## User List Presence *In other words, as a logged-in user, when I retrieve the user list, how do I know if a user is online/offline?* @@ -81,3 +117,16 @@ When you [retrieve the list of users](/sdk/flutter/retrieve-users) , in the[User * `offline` - This indicates that the user is currently offline and is not available to chat. 2. `lastActiveAt` - In case the user is offline, this field holds the timestamp of the time when the user was last online. This can be used to display a **Last seen** for that user. + +--- + +## Next Steps + + + + Fetch user lists with presence status included + + + Monitor SDK connection state changes + + diff --git a/sdk/flutter/users-overview.mdx b/sdk/flutter/users-overview.mdx index 3a340e5e3..54cef3653 100644 --- a/sdk/flutter/users-overview.mdx +++ b/sdk/flutter/users-overview.mdx @@ -1,10 +1,39 @@ --- title: "Users" sidebarTitle: "Overview" +description: "Manage users in CometChat - retrieve user lists, track presence status, block users, and handle user management operations." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +Choose your path: +- **Retrieve Users** → [retrieve-users](/sdk/flutter/retrieve-users) - Fetch and filter user lists +- **User Presence** → [user-presence](/sdk/flutter/user-presence) - Track online/offline status +- **Block Users** → [block-users](/sdk/flutter/block-users) - Block and unblock users +- **User Management** → [user-management](/sdk/flutter/user-management) - Create, update, delete users + The primary aim for our users functionality is to allow you to quickly retrieve and add users to CometChat. You can begin with [user management](/sdk/flutter/user-management) to sync your users to CometChat. Once that is done, you can [retrieve users](/sdk/flutter/retrieve-users) and display them in your app. + +--- + +## Next Steps + + + + Fetch and filter user lists with pagination + + + Track real-time online/offline status + + + Block and unblock users in your app + + + Create, update, and delete users + + diff --git a/sdk/flutter/video-view-customisation.mdx b/sdk/flutter/video-view-customisation.mdx index d48d8ccdf..15f2ab1db 100644 --- a/sdk/flutter/video-view-customisation.mdx +++ b/sdk/flutter/video-view-customisation.mdx @@ -1,8 +1,31 @@ --- title: "Video View Customisation" +description: "Learn how to customize the main video container appearance and controls in CometChat Flutter calling." --- +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** +```dart +// Create video container settings +MainVideoContainerSetting videoSettings = MainVideoContainerSetting(); + +// Set aspect ratio +videoSettings.setMainVideoAspectRatio(VideoStreamsMode.ASPECT_RATIO_CONTAIN); + +// Configure UI element positions and visibility +videoSettings.setNameLabelParams(VideoStreamsPosition.POSITION_TOP_LEFT, true, "#000"); +videoSettings.setZoomButtonParams(VideoStreamsPosition.POSITION_TOP_RIGHT, true); +videoSettings.setUserListButtonParams(VideoStreamsPosition.POSITION_TOP_LEFT, true); +videoSettings.setFullScreenButtonParams(VideoStreamsPosition.POSITION_TOP_RIGHT, true); + +// Apply to CallSettings +CallSettings callSettings = (CallSettingsBuilder() + ..setMainVideoContainerSetting(videoSettings) +).build(); +``` + This section will guide you to customise the main video container. @@ -40,3 +63,22 @@ videoSettings.setFullScreenButtonParams(VideoStreamsPosition.POSITION_TOP_RIGHT, + +--- + +## Next Steps + + + + Implement direct calls without a ringing flow + + + Enable screen sharing and presenter features + + + Implement calls with a complete ringing flow + + + Configure the CometChat Calling SDK + + diff --git a/sdk/flutter/webhooks-overview.mdx b/sdk/flutter/webhooks-overview.mdx index 598d43500..d345f7bee 100644 --- a/sdk/flutter/webhooks-overview.mdx +++ b/sdk/flutter/webhooks-overview.mdx @@ -1,4 +1,119 @@ --- title: "Webhooks" +sidebarTitle: "Webhooks" +description: "Configure server-side webhooks to receive real-time notifications for messages, users, groups, calls, and moderation events in your Flutter application." url: "/fundamentals/webhooks-overview" ---- \ No newline at end of file +--- + +{/* TL;DR for Agents and Quick Reference */} + +**Quick Reference for AI Agents & Developers** + +Webhooks send HTTP POST requests to your server when events occur: + +**Setup Requirements:** +- HTTPS endpoint (SSL required) +- Publicly accessible URL +- Support POST method with `application/json` +- Return HTTP 200 OK to acknowledge receipt + +**Event Categories:** +- **Messages:** `message_sent`, `message_edited`, `message_deleted`, `message_read_receipt` +- **Users:** `user_blocked`, `user_unblocked`, `user_connection_status_changed` +- **Groups:** `group_created`, `group_member_added`, `group_member_left` +- **Calls:** `call_initiated`, `call_started`, `call_ended`, `recording_generated` +- **Moderation:** `moderation_engine_approved`, `moderation_engine_blocked` + +**Configure via:** [CometChat Dashboard](https://app.cometchat.com) → Your App → Webhooks + + +CometChat Webhooks enable real-time, event-driven communication with your server by sending HTTP POST requests for specific events such as messages, user actions, group updates, calls, and moderation results. + +You can use webhooks to build custom workflows such as sending SMS or email notifications, logging activity, syncing with external systems, or triggering automation. + + +Webhooks are configured at the application level through the CometChat Dashboard, not within the Flutter SDK. The SDK handles real-time events via listeners, while webhooks deliver events to your backend server. + + +--- + +## When to Use Webhooks vs SDK Listeners + +| Use Case | Solution | +| --- | --- | +| Real-time updates in Flutter app | SDK Listeners (`CometChatMessageEvents`, `CometChatUserEvents`) | +| Server-side processing | Webhooks | +| Push notifications to offline users | Webhooks | +| Analytics and logging | Webhooks | +| Third-party integrations | Webhooks | +| Syncing with external databases | Webhooks | + +--- + +## Setting Up Webhooks + +Webhooks are configured through the CometChat Dashboard: + + + + Go to [CometChat Dashboard](https://app.cometchat.com) → Your App → Webhooks + + + Click **Create Webhook** and enter your HTTPS endpoint URL + + + Choose which events should trigger webhook calls (messages, users, groups, calls, moderation) + + + Set up Basic Authentication with username/password for security + + + +--- + +## Webhook Endpoint Requirements + +Your webhook endpoint must meet these criteria: + +1. **Use HTTPS** – All webhook URLs must be secured with SSL +2. **Be publicly accessible** – Your server should be reachable from the internet +3. **Support POST method** – Events are delivered as `HTTP POST` requests with `application/json` content +4. **Return HTTP 200 OK** – Acknowledge receipt within 2 seconds + +--- + +## Best Practices + + + + Enable `retryOnFailure` when setting up webhooks. CometChat retries failed deliveries after 10 seconds, then 30 seconds. Use unique event IDs to deduplicate retries. + + + For long processing tasks, enqueue events to systems like Kafka, RabbitMQ, or AWS SQS, and process them asynchronously. Respond within 2 seconds to prevent timeouts. + + + Return appropriate HTTP status codes: `200 OK` for success, `4xx` for client errors, `5xx` for server issues. + + + Maintain detailed logs of incoming webhook requests and responses. Track failures, latency, and retry attempts. + + + +--- + +## Next Steps + + + + Handle events directly in your Flutter app with SDK listeners + + + Explore additional SDK resources and documentation + + + View all webhook event payloads and details + + + Learn how to create and manage webhooks via REST API + +