Conversation overview
Learn about ConversationInfo, conversationID, conversation settings, and conversation events in the Android SDK.
A conversation is the chat-list state maintained by the signed-in account for a one-to-one or group chat. A ConversationInfo record contains unread count, latest message, pinning, draft, message reception, and extension data. conversationID uniquely identifies a conversation and is used to query conversation information and set conversation state; the chat target is the peer userID for a one-to-one chat or the groupID for a group chat.
Group profile, membership, and permissions belong to Group APIs. Use groupID for group operations and conversationID for conversation settings, unread state, drafts, and message cleanup.
Conversation identifiers
| Identifier | Purpose |
|---|---|
conversationID | Conversation record ID for settings, unread state, and message history. |
userID | Peer user ID in a one-to-one chat. |
groupID | Group ID for a group chat and Group API target. |
sourceId | Chat target passed to queries and ID resolution: userID for a one-to-one chat, groupID for a group chat. |
ConversationInfo
| Field | Description |
|---|---|
conversationID | Conversation ID. |
conversationType | Conversation type: ConversationType.SINGLE_CHAT for one-to-one chats; ConversationType.GROUP_CHAT or ConversationType.SUPER_GROUP_CHAT for group chats. |
userID / groupID | userID identifies the peer user in a one-to-one chat, while groupID identifies the target group in a group chat. Only one applies. |
showName | Conversation name: the target user's nickname or remark for a one-to-one chat, and the group name or remark for a group chat. |
faceURL | Conversation avatar URL. |
unreadCount | Unread count for the conversation. |
latestMsg | JSON string for the latest message. |
latestMsgSendTime | Send time of the latest message. |
recvMsgOpt | Message reception option for the conversation. |
groupAtType | Group mention reminder state. |
draftText | Conversation draft. |
draftTextTime | Draft update time. |
isPinned | Whether the conversation is pinned. |
isPrivateChat | Whether burn after reading is enabled. |
burnDuration | Reading duration for burn-after-reading messages, in seconds. |
isMsgDestruct | Whether scheduled server-message deletion is enabled. |
msgDestructTime | Scheduled server-message deletion time. |
ext | Reserved conversation extension string. |
ex | Application-defined conversation extension string. |
isNotInGroup | Whether the current user is no longer in the group. |
Find pages by task
| Task | Pages |
|---|---|
| Query one, several, or a paginated list of conversations | Get a conversation by target, Get conversations by ID, Get the conversation list |
| Generate a conversation ID | Generate a conversation ID |
| Organize the conversation list | Pin or unpin a conversation, Hide a conversation |
| Maintain drafts and extension data | Set a conversation draft, Set conversation extension data |
| Set message reception and retention policy | Set conversation message reception, Enable or disable burn after reading, Set burn-after-reading duration, Schedule server message deletion |
| Handle unread counts and group mention reminders | Mark a conversation as read, Get the total unread count, Reset group mention status |
| Delete or clear conversation data | Delete a conversation and its messages, Clear messages in a conversation |
State updates
After you set an OnConversationListener, you can receive changes to the conversation list and total unread count. See Get the conversation list for complete listener setup:
onNewConversation: Receives newly created conversations.onConversationChanged: Receives conversation property changes, such as unread count, pinning, and drafts.onTotalUnreadMessageCountChanged: Receives changes to the signed-in account's total unread message count.
Each call to setOnConversationListener() replaces the previously set listener.
Was this page helpful?