Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Key Classes | TextMessage, CustomMessage, BaseMessage |
| Key Methods | CometChat.editMessage() |
| Listener Events | onMessageEdited |
| Prerequisites | SDK initialized, user logged in |
- Adding a listener for real-time edits when your app is running
- Fetching missed edits when your app was offline
Edit a Message
UseeditMessage() with a TextMessage or CustomMessage object. Set the message ID using the id property.
| Parameter | Type | Description |
|---|---|---|
message | BaseMessage | The message object to edit. Must be a TextMessage or CustomMessage. Set the id property to the ID of the message to edit. |
onSuccess | Function(BaseMessage) | Callback triggered on success with the edited message object. |
onError | Function(CometChatException) | Callback triggered on error with exception details. |
Add/Update Tags
Usetags to update tags when editing. New tags replace existing ones.
- Text Message
- Custom Message
editMessage().
- Dart
Response
Response
On Success — A
BaseMessage object containing all details of the edited message:BaseMessage Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
id | number | Unique message ID | 401 |
metadata | object | Custom metadata attached to the message | {} |
receiver | object | Receiver user object | See below ↓ |
editedBy | string | UID of the user who edited the message | "cometchat-uid-1" |
conversationId | string | Unique conversation identifier | "cometchat-uid-1_user_cometchat-uid-2" |
sentAt | number | Epoch timestamp when the message was sent | 1745554729 |
receiverUid | string | UID of the receiver | "cometchat-uid-2" |
type | string | Type of the message | "text" |
readAt | number | Epoch timestamp when the message was read | 0 |
deletedBy | string | UID of the user who deleted the message | null |
deliveredAt | number | Epoch timestamp when the message was delivered | 1745554750 |
deletedAt | number | Epoch timestamp when the message was deleted | 0 |
replyCount | number | Number of replies to this message | 0 |
sender | object | Sender user object | See below ↓ |
receiverType | string | Type of the receiver | "user" |
editedAt | number | Epoch timestamp when the message was edited | 1745554800 |
parentMessageId | number | ID of the parent message (for threads) | 0 |
readByMeAt | number | Epoch timestamp when read by the current user | 0 |
category | string | Message category | "message" |
deliveredToMeAt | number | Epoch timestamp when delivered to the current user | 0 |
updatedAt | number | Epoch timestamp when the message was last updated | 1745554800 |
unreadRepliesCount | number | Count of unread replies | 0 |
quotedMessageId | number | ID of the quoted message | null |
sender Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
uid | string | Unique identifier of the sender | "cometchat-uid-1" |
name | string | Display name of the sender | "Andrew Joseph" |
link | string | Profile link | null |
avatar | string | Avatar URL | "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp" |
metadata | object | Custom metadata | {} |
status | string | Online status | "online" |
role | string | User role | "default" |
statusMessage | string | Status message | null |
tags | array | User tags | [] |
hasBlockedMe | boolean | Whether this user has blocked the current user | false |
blockedByMe | boolean | Whether the current user has blocked this user | false |
lastActiveAt | number | Epoch timestamp of last activity | 1745554700 |
receiver Object:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
uid | string | Unique identifier of the receiver | "cometchat-uid-2" |
name | string | Display name of the receiver | "George Alan" |
link | string | Profile link | null |
avatar | string | Avatar URL | "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp" |
metadata | object | Custom metadata | {} |
status | string | Online status | "offline" |
role | string | User role | "default" |
statusMessage | string | Status message | null |
tags | array | User tags | [] |
hasBlockedMe | boolean | Whether this user has blocked the current user | false |
blockedByMe | boolean | Whether the current user has blocked this user | false |
lastActiveAt | number | Epoch timestamp of last activity | 1745550000 |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | string | Error code identifier | "ERR_CHAT_API_FAILURE" |
message | string | Human-readable error message | "The message could not be modified." |
details | string | Additional technical details | "An unexpected error occurred while processing the request." |
editedAt (timestamp) and editedBy (UID of editor) fields set.
The editMessage() method returns a BaseMessage object (or a subclass like TextMessage).
Relevant fields to access on the returned message:
| Field | Property | Return Type | Description |
|---|---|---|---|
| editedAt | editedAt | int | Timestamp when the message was edited |
| editedBy | editedBy | String | UID of the user who edited the message |
| User Role | Conversation Type | Edit Capabilities |
|---|---|---|
| Message Sender | One-on-one Conversation | Messages they’ve sent |
| Message Sender | Group Conversation | Messages they’ve sent |
| Group Owner | Group Conversation | All messages in the group |
| Group Moderator | Group Conversation | All messages in the group |
Real-time Message Edit Events
UseonMessageEdited in MessageListener to receive real-time edit events.
- Dart
onMessageEdited callback receives a BaseMessage object with the editedAt and editedBy fields set.
Relevant fields to access on the returned message:
| Field | Property | Return Type | Description |
|---|---|---|---|
| editedAt | editedAt | int | Timestamp when the message was edited |
| editedBy | editedBy | String | UID of the user who edited the message |
Missed Message Edit Events
When fetching message history, edited messages haveeditedAt and editedBy fields set. Additionally, an Action message is created when a message is edited.
The Action object contains:
action—editedactionOn— Updated message object with the edited detailsactionBy— User object containing the details of the user who has edited the messageactionFor— User/group object having the details of the receiver to which the message was sent
You must be the message sender or a group admin/moderator to edit a message.
Next Steps
Delete Message
Learn how to delete messages from conversations
Send Message
Send text, media, and custom messages
Receive Messages
Handle incoming messages in real-time
Threaded Messages
Create and manage message threads