Conversation

Conversation

Conversation object, used to describe the properties of a conversation, including the conversation type, message unread count, and latest message

Properties:
Name Type Description
conversationID String

Conversation ID. Supported formats are as follows:

  • C2C${userID} (one-to-one chat)
  • GROUP${groupID} (group chat)
  • @TIM#SYSTEM (system notification conversation)
type String

Conversation type. Supported values are as follows:

Type Description
TIM.TYPES.CONV_C2C Client to Client (C2C) conversation
TIM.TYPES.CONV_GROUP Group conversation
TIM.TYPES.CONV_SYSTEM System conversation, which can only receive notifications from the system and cannot send messages
subType String

Group type of a group conversation. Supported values are as follows:

Type Description
TIM.TYPES.GRP_WORK Work group
TIM.TYPES.GRP_PUBLIC Public group
TIM.TYPES.GRP_MEETING Meeting group
TIM.TYPES.GRP_AVCHATROOM Audio-video group
unreadCount Number

Unread message count. TIM.TYPES.GRP_MEETING and TIM.TYPES.GRP_AVCHATROOM groups do not support the unread count feature, and this field is 0 for them.

lastMessage Object

Latest message of the conversation

Properties
Name Type Description
lastTime Number

Timestamp of the latest message of the current conversation, in seconds

lastSequence Number

Sequence number of the latest message of the current conversation

fromAccount String

userID of the source user of the latest message

messageForShow String

Content of the latest message for display. Possible values: text message content, "[image]", "[audio]", "[location]", "[emoji]", "[file]", "[custom message]"
If the field does not meet your requirements, you can customize the rendering using payload.

type String

Message type. Supported values are as follows:

Type Description
TIM.TYPES.MSG_TEXT Text message
TIM.TYPES.MSG_IMAGE Image message
TIM.TYPES.MSG_SOUND Audio message (Disused. Please use TIM.TYPES.MSG_AUDIO.)
TIM.TYPES.MSG_AUDIO Audio message
TIM.TYPES.MSG_FILE File message
TIM.TYPES.MSG_GRP_TIP Group notification
TIM.TYPES.MSG_GRP_SYS_NOTICE Group system message
payload Object

Message content. Supported content types are as follows:

groupProfile Group

Group profile of a group conversation

userProfile Profile

User profile of a C2C conversation

groupAtInfoList Array.<GroupAtInfo>

@ information list of a group conversation, which can be used by the access side to display "someone@me" or "@All" notifications on the conversation list. GroupAtInfo - Group @ information structure is supported from v2.9.0.

remark String

Friend remarks. This field has a value only for a C2C conversation where the peer party is my friend and I have set remarks for this friend (supported from v2.13.0).

isPinned Boolean

Whether the conversation is pinned on top (supported from v2.14.0)

Type Definitions

GroupAtInfo

Properties:
Name Type Description
groupID String

Group ID

messageSequence Number

Sequence number of a message with @ information

atTypeArray Array.<Number>

@ type array. Enumerated values of group conversation @ types are as follows:

  • TIM.TYPES.CONV_AT_ME: someone@me
  • TIM.TYPES.CONV_AT_ALL: @all in the group
  • TIM.TYPES.CONV_AT_ALL_AT_ME: @all in the group and @me alone

Group @ information structure