Options
All
  • Public
  • Public/Protected
  • All
Menu

单聊、群聊和超大群的消息体

Hierarchy

  • NIMMessage

Index

Properties

apns?: { accounts?: string[]; content?: string; forcePush?: boolean }

特殊推送选项, 只在群会话中使用

Type declaration

  • Optional accounts?: string[]

    需要特殊推送的账号列表, 此字段不存在的话表示推送给当前会话内的所有用户

  • Optional content?: string

    需要特殊推送的文案

  • Optional forcePush?: boolean

    是否强制推送, 默认 false

    true 表示即使推送列表中的用户屏蔽了当前会话(如静音), 仍能够推送当前这条内容给相应用户

群通知消息的附加信息。当 type 为 notification 时存在

callbackExt?: string

第三方回调的扩展字段

cc?: boolean

是否支持抄送,默认 true

content?: string

自定义消息的消息内容, 开发者可以自行扩展, 建议封装成 JSON 序列化后的字符串. 当 type 为 custom 时存在

custom?: string

扩展字段

注:推荐传入 JSON 序列化的字符串

delete?: boolean

该消息是否已被撤回或单向删除,获取 thread 消息列表时会用到

env?: string

指定当前消息需要抄送到或者回调到的环境的名称。开通消息抄送或第三方回调后,该环境名称可在云信控制台中配置(如下图),最大 32 个字符。

note

文件消息的文件对象. 当 type 为 image, audio, video, file 时,且 status 为 success 时存在

flow: string

消息的流向

'in' 代表这是收到的消息. 'out' 代表这是发出的消息

from: string

消息发送方, 帐号

fromClientType?: string

发送方的设备类型

fromDeviceId?: string

发送端设备id

fromNick?: string

消息发送方的昵称

geo?: NIMMsgGEO

地理位置消息的地理位置对象. 当 type 为 geo 时存在

idClient: string

端测生成的消息id, 可作为消息唯一主键使用。

idServer?: string

服务器用于区分消息用的ID, 用于获取历史消息和获取包含关键词的历史消息。

注:此字段可能没有, 比如说消息被反垃圾过滤了。

isHistoryable?: boolean

是否存储云端历史,默认 true

isInBlackList?: boolean

发送方 'from' 是否在接收方 'to' 的黑名单列表中

isLocal?: boolean

是否是本地数据库消息, 默认 false

isMuted?: boolean

该消息在接收方是否应该被静音

isOfflinable?: boolean

是否要存离线,默认 true

isPushable?: boolean

是否需要推送,默认 true

isReplyMsg?: boolean

是否为应答消息(用于机器人等类似场景等应答消息内容)

isRoamingable?: boolean

是否支持漫游,默认 true

isSyncable?: boolean

是否支持发送者多端同步,默认 true

isUnreadable?: boolean

是否计入消息未读数,默认 true

localCustom?: string

本地数据库自定义扩展字段,开启 db 时有效。

needPushNick?: boolean

是否需要推送昵称

needUpdateSession?: boolean

是否需要刷新服务器会话列表,默认是true

pushContent?: string

自定义推送文案

pushPayload?: string

自定义的推送属性。更多说明及相关示例请参见推送payload配置

注:必须传入 JSON 序列化的字符串

replyMsgFromAccount?: string

被回复消息的发送者账号

replyMsgIdClient?: string

被回复消息的 idClient

replyMsgIdServer?: string

被回复消息的 idServer

replyMsgTime?: number

被回复消息的时间

replyMsgToAccount?: string

被回复消息的接受者账号

resend?: boolean

是否是重发的消息,默认是 false

scene: "p2p" | "team" | "superTeam"

消息场景:

  • p2p:单聊场景
  • team:群聊场景
  • superteam:超大群场景
sessionId: string

消息所属的会话的ID

status: string

消息发送状态

'sending' 发送中 'success' 发送成功 'fail' 发送失败

subType?: number

开发者自定义的消息子类型,格式为大于0的整数

target: string

聊天对象, 账号或者群id

tempTeamMemberCount?: number

群已读消息快照大小(即消息发送时的群人数-1)

text?: string

文本消息的文本内容. 当 type 为 text 时存在

threadMsgFromAccount?: string

thread 消息的发送者账号

threadMsgIdClient?: string

thread消息的idClient

threadMsgIdServer?: string

thread消息的idServer

threadMsgTime?: number

thread消息的时间

threadMsgToAccount?: string

thread消息的接受者账号

time: number

时间戳

tip?: string

提醒消息的内容. 当 type 为 tip 时存在

to: string

消息接收方, 帐号或群id

type: "custom" | "text" | "image" | "audio" | "video" | "geo" | "notification" | "file" | "tip" | "robot" | "g2"

消息类型

userUpdateTime: number

发送方信息更新时间

yidunAntiSpamRes?: string

易盾反垃圾结果。

注:若开启了易盾反垃圾,并且针对文本或图片如果被反垃圾策略匹配中,端测会透传此反垃圾结果字段。