会话强提醒
强提醒介绍
用户在发消息的时候,可以通过在消息中携带 MsgNotice
数据字段,实现提及他人的强提醒消息(如@人)。同时接收方能在会话列表的会话摘要中,重点显示 “有人@我” 、“@所有人” 或其他的强提醒标识,用于提示用户有人在群里 @/提到 自己了。协作中台中内置了部分常见的强提醒类型(如@人),也支持接入方根据业务场景自定义强提醒类型。
获取强提醒列表
获取指定会话中,所有未读的强提醒数据列表。
接口定义
swift
func getChatNotices(chatId: String, types: [String], lastMsgTime: Int64, count: Int32, order: Int32, complete: ((_ notices: [KIMMsgNotice]?, _ lastMsgTime: Int64, _ total: Int32, _ error: KIMError?) -> Void)?)
Objective-C
- (void)getChatNoticesWithChatId:(NSString * _Nonnull)chatId types:(NSArray<NSString *> * _Nonnull)types lastMsgTime:(int64_t)lastMsgTime count:(int32_t)count order:(int32_t)order complete:(void (^ _Nullable)(NSArray<KIMMsgNotice *> * _Nullable, int64_t, int32_t, KIMError * _Nullable))complete;
参数说明
参数 | 类型 | 说明 |
---|---|---|
chatId | String | 会话 ID |
types | [String] | 强提醒类型,传空获取全部 |
lastMsgTime | Int64 | 当前页开始时间,首页 0 |
count | Int32 | 分页获取数量 |
order | Int32 | 排序,0-asc, 1-desc |
complete | (_ notices: [KIMMsgNotice]?, _ lastMsgTime: Int64, _ total: Int32, _ error: KIMError?) -> Void | 完成回调。notices:强提醒列表;lastMsgTime:一页的起始时间;total:强提醒总数;error:失败时的错误信息 |
KIMMsgNotice
说明:
属性 | 类型 | 说明 |
---|---|---|
msgId | string | 消息 ID |
msgTime | Int64 | 消息时间(ns) |
notices | [KIMChatNotice] | 强提醒数据 |
KIMChatNotice
说明
属性 | 类型 | 说明 |
---|---|---|
noticeType | String | 强提醒类型 "kim-mention": @人强提醒 |
noticeTarget | Int | 强提醒对象, 1-只有全员提醒,2-只有个人提醒,3-同时提醒个人与全员 |
示例代码
swift
KIMCore.shared.getChatNotices(chatId: chatId, types: types, lastMsgTime: lastMsgTime, count: count, order: order) { notices, lastMsgTime, total, error in
}