getConversation
Introduction
Load the specific conversation.
A locally stored conversation list can have unlimited number of conversations. A conversation list stored in the cloud can have up to 100 conversations.
If the information of a conversation has not been updated for a long time, this conversation can be stored in the cloud for at most 7 days. To adjust the period for storing the conversation, contact us.
Locally stored conversations may not always be consistent with those stored in the cloud. If you do not call the deleteConversation API to delete the local conversations, these conversations will always exist. However, at most 100 conversations can be stored in the cloud. In addition, if the information of a conversation has not been updated for a long time, this conversation can be stored in the cloud for at most 7 days. Therefore, local conversations displayed on different mobile phones may be inconsistent with each other.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
conversationID | string | yes | The unique identifier of a conversation, it will be format in "c2c_${userId}" or "${groupID}". |
Returned template
V2TimValueCallback<V2TimConversation>
{
code : number
desc : string
data : {
conversationID : string
type : number
userID : string
groupID : string
showName : string
faceUrl : string
groupType : string
unreadCount : number
lastMessage : V2TimMessage
draftText : string
draftTimestamp : number
isPinned : boolean
recvOpt : number
groupAtInfoList : V2TimGroupAtInfo[]
orderkey : number
}
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
data | V2TimConversation | The conversation obtained. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const getConversationtRes = await TencentImSDKPlugin.v2TIMManager
.getConversationManager()
.getConversation('');
if (getConversationtRes.code === 0) {
getConversationtRes.data?.conversationID;
getConversationtRes.data?.draftText;
getConversationtRes.data?.draftTimestamp;
getConversationtRes.data?.faceUrl;
getConversationtRes.data?.groupAtInfoList;
getConversationtRes.data?.groupID;
getConversationtRes.data?.groupType;
getConversationtRes.data?.isPinned;
getConversationtRes.data?.lastMessage;
getConversationtRes.data?.orderkey;
getConversationtRes.data?.recvOpt;
getConversationtRes.data?.showName;
getConversationtRes.data?.type;
getConversationtRes.data?.unreadCount;
getConversationtRes.data?.userID;
}