IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMMessageabstract
Swift - V2TIMMessage
Swift

Class V2TIMMessage

public class V2TIMMessage  

Definition of V2TIMMessage

Initializers

init()

public init()  

Properties

description

public var description: String  

msg​ID

public var msgID: String  

Message ID

timestamp

public var timestamp: Date  

UTC timestamp of the message

sender

public var sender: String?  

Sender's userID

nick​Name

public var nickName: String?  

Sender's nickname

friend​Remark

public var friendRemark: String?  

Sender's friend remark. If friend information has not been pulled or the user is not a friend, nil will be returned.

name​Card

public var nameCard: String?  

Get the message sender's alias in the group (valid for group messages)

face​URL

public var faceURL: String?  

Sender's profile photo URL

group​ID

public var groupID: String?  

Get the groupID. If the message is not a group message, nil will be returned.

user​ID

public var userID: String?  

Get the ID of the other user for one-to-one messages (whether sent by the local or remote user). For group messages, nil will be returned.

seq

public var seq: UInt  

Sequence number of the message

Message sequence numbers in group chats are generated in the cloud and are strictly incremented and unique within the group. Message sequence numbers in one-to-one chats are generated locally and are not necessarily strictly incremented or unique.

random

public var random: UInt  

Random number of the message

status

public var status: V2TIMMessageStatus  

Message sending status

is​Self

public var isSelf: Bool  

Whether the message sender is the current user

is​Read

public var isRead: Bool  

Whether the message has been read by the current user

is​Peer​Read

public var isPeerRead: Bool  

Whether the message was read by the other user(valid only for one-to-one messages). "true" will be returned if the message timestamp is equal to or smaller than the timestamp when the other user marked the message as read.

need​Read​Receipt

public var needReadReceipt: Bool  

Set whether to enable read receipts

  • For group chats, read receipts are supported in 6.1 and later versions. You need to go to the Chat console to set the group types that support the feature first.

  • For one-to-one chats, the feature is supported in 6.2 and later versions.

  • The feature is only available in the Premium Edition.

support​Message​Extension

public var supportMessageExtension: Bool  

Set whether to enable message extension (supported only in Chat Premium 6.7 and later versions)

  • You need to configure message extension in the Chat console first. AVChatRoom groups do not support this feature.

  • You need to buy Premium Edition to use this feature.

is​Broadcast​Message

public var isBroadcastMessage: Bool  

Whether the message is a broadcast message (supported only for AVChatRoom groups in Chat Premium v6.5 or later)

priority

public var priority: V2TIMMessagePriority  

Message priority (valid only for the message of the onRecvNewMessage callback)

group​AtUser​List

public var groupAtUserList: Array<String>?  

UserID list of users who has been @ in the group message

elem​Type

public var elemType: V2TIMElemType  

Message type

text​Elem

public var textElem: V2TIMTextElem?  

Get the content of a text message (V2TIM_ELEM_TYPE_TEXT)

custom​Elem

public var customElem: V2TIMCustomElem?  

Get the content of a custom message (V2TIM_ELEM_TYPE_CUSTOM)

image​Elem

public var imageElem: V2TIMImageElem?  

Get the content of an image message (V2TIM_ELEM_TYPE_IMAGE)

sound​Elem

public var soundElem: V2TIMSoundElem?  

Get the content of a voice message (V2TIM_ELEM_TYPE_SOUND)

video​Elem

public var videoElem: V2TIMVideoElem?  

Get the content of a video message (V2TIM_ELEM_TYPE_VIDEO)

file​Elem

public var fileElem: V2TIMFileElem?  

Get the content of a file message (V2TIM_ELEM_TYPE_FILE, fileElem)

location​Elem

public var locationElem: V2TIMLocationElem?  

Get the content of a location message (V2TIM_ELEM_TYPE_LOCATION)

face​Elem

public var faceElem: V2TIMFaceElem?  

Get the content of an emoji message (V2TIM_ELEM_TYPE_FACE)

merger​Elem

public var mergerElem: V2TIMMergerElem?  

Get the content of a forwarded message (V2TIM_ELEM_TYPE_MERGER)

group​Tips​Elem

public var groupTipsElem: V2TIMGroupTipsElem?  

Get the content of a group tip message (V2TIM_ELEM_TYPE_GROUP_TIPS)

local​Custom​Data

public var localCustomData: Data?  

Custom message data. The data is saved locally and will not be sent. It will be lost after the app is reinstalled.

local​Custom​Int

public var localCustomInt: Int  

Custom message data. The data is saved locally and will not be sent. It will be lost after the app is reinstalled.

cloud​Custom​Data

public var cloudCustomData: Data?  

Cloud custom data. The data is saved in the cloud and will be sent. It can be pulled even after the app is reinstalled.

is​Excluded​From​Unread​Count

public var isExcludedFromUnreadCount: Bool  

Set or get whether to exclude the message from the unread message count. false (default): included in the unread message count; true: excluded from the unread message count

Supported only in 5.3.425 and later versions and not supported by meeting groups by default

is​Excluded​From​Last​Message

public var isExcludedFromLastMessage: Bool  

Set whether to skip the message when determining the conversation's lastMessage. false (default): do not skip; true: skip

Supported only in 5.4.666 and later versions.

is​Excluded​From​Content​Moderation

public var isExcludedFromContentModeration: Bool  

Set whether to exclude the current message from content moderation (cloud moderation). The default value is false.

Works only if cloud moderation is enabled. [Cloud moderation] please refer to document [cloud moderation function](https://cloud.tencent.com/document/product/269/83795#.E4.BA.91.E7.AB.AF.E5.AE.A1 .E6.A0.B8.E5.8A.9F.E8.83.BD) Supported only in 7.1 and later versions.

custom​Moderation​Configuration​ID

public var customModerationConfigurationID: String?  

Message custom moderation configuration (supported in 7.8 and later versions and valid only if cloud moderation is enabled)

You can go to the console (On-cloud moderation -> Moderation configuration -> Custom configuration -> Add custom configuration) to get the configuration ID.

has​Risk​Content

public var hasRiskContent : Bool  

Whether the current message is identified as risk message (supported only in 7.4 and later versions)

This feature is only supported for voice and video messages. This API works only if cloud moderation is enabled. If a voice or video message sent is non-compliant, the onRecvMessageModified callback will be triggered, and the "hasRiskContent()" field in the callback message will be "true".

disable​Cloud​Message​Pre​Hook

public var disableCloudMessagePreHook: Bool  

Whether to disable the cloud message hook before sending(supported only in imsdk 8.1 and later versions)

disable​Cloud​Message​Post​Hook

public var disableCloudMessagePostHook: Bool  

Whether to disable the cloud message hook after sending(supported only in imsdk 8.1 and later versions)

offline​Push​Info

public var offlinePushInfo: V2TIMOfflinePushInfo?  

Offline push information of the message

revoker​Info

public var revokerInfo: V2TIMUserFullInfo?  

Revoker's info (supported only in imsdk 7.4 and later versions)

Valid only for revoked message

revoke​Reason

public var revokeReason: String?  

Revoke reason (supported only in imsdk 7.4 and later versions)

Valid only for revoked message

pinner​Info

public var pinnerInfo: V2TIMGroupMemberFullInfo?  

Pinner's info (supported only in imsdk 8.0 and later versions)

This field is only present in the pinned messages obtained through the GetPinnedGroupMessageList API