回调通知分为事件发生前和事件发生后两类:
Response 中对客户端发起请求进行修改。注意:通过服务端openapi发起的请求不会触发 "事件发生前" 回调,仅会触发 "事件发生后" 的回调。
回调通知服务支持的事件有:
BeforeSendMessageBeforeCreateConversationBeforeAddParticipantBeforeCreateSingleConversationBeforeRemoveParticipantBeforeUpdateConversationBeforeUpdateParticipantBeforeUpdateSettingAfterRemoveParticipantAfterAddParticipantParticipantStateChangeOnlineStateChangeAfterCreateConversationAfterPushAfterSendMessageAfterSetPropertyBeforeSendMessage
消息发送前。
该回调支持单聊、普通群和直播群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ClientMessageId | String | "ClientMessageId" | 消息客户端Id,如果端上消息发送失败,会进行重试,可通过此字段进行幂等判断 |
| Header | map-key(string)-value(string) | {"IP":"xxx.xxx.xxx.xxx"} | 消息发送方的元信息,目前已有的key为:
|
| MessageBody | MessageBody | / | 消息详情 |
| RefMsgInfo | RefMsgInfo | / | 引用消息详情 |
| ToId | Int | 000010 |
|
MessageBody
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Content | String | Your_Content | 消息内容 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型
|
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段 |
| MsgType | Int | 10001 | 消息类型
|
| Sender | Int | 000010 | 消息发送人 UserId |
| MessageId | Int | 000012 | 消息 ID |
| MentionedUsers | Array of Int | [10001,10002] | 此条消息at的用户列表 |
| MessagePriority | Int | 1 | 消息优先级
|
RefMsgInfo
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Content | String | Your_Content | 被引用的消息内容 |
| Hint | String | [图片] | 消息引用时展示的文本内容 |
| InvisibleUsers | Array of Int | [111111] | 消息不可见群成员列表。 |
| VisibleUsers | Array of Int | [111111] | 消息可见群成员列表 |
| ReferenceMessageId | Int | 000013 | 消息 ID |
| ReferenceMessageType | Int | 10001 | 消息类型。
|
| Status | Int | 0 | 消息状态,取值为0,表示消息可见。 |
{
"AppId": 000000,
"InboxType": 0,
"MessageBody": {
"Content": "Your_Content",
"ConversationShortId": 000001,
"ConversationType": 2,
"Ext": {
"key":"value"
},
"MsgType": 10001,
"Sender": 000010,
"MessageId": 000012,
"MentionedUsers":[],
"MessagePriority":1
},
"RefMsgInfo": {
"Content": "Your_Content",
"Hint": "[图片]",
"InvisibleUsers": [],
"VisibleUsers": [],
"ReferenceMessageId": 000013,
"ReferenceMessageType": 10001,
"Status": 0
},
"ToId": 000011,
"ClientMessageId":"ClientMessageId",
"Header":{
"IP":"xxxxx"
}
}
json此条消息最终会以业务服务端传入的Ext,Content、InvisibleUsers 或 VisibleUsers 的值为准,如果不想修改用户传入原始的Content等字段,这些值传 null或者Response的json中不出现此字段。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示发送消息失败 |
| CheckMessage | String | / | 消息发送失败原因 |
| MessageBody | MessageBody | / | 消息详情 |
MessageBody
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。 |
| Content | String | Your_Content | 消息内容 |
| InvisibleUsers | Array of Int | [111111] | 消息不可见群成员列表。 |
| MentionedUsers | Array of Int | [111111,22222] | 此条消息at的用户列表 |
| MessagePriority | Int | 1 | 消息优先级
|
{
"CheckCode":0,
"CheckMessage":""
"MessageBody":{
"Ext":null,
"Content":null,
"VisibleUsers":null,
"InVisibleUsers":null,
"MentionedUsers":null,
"MessagePriority":1
}
}
jsonBeforeCreateConversation
创建群聊前。
该回调支持普通群和直播群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| Description | String | Your_Description | 群描述 |
| AvatarUrl | String | http://xxx.com | 群头像 url |
| Name | String | Conversation | 群名 |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ParticipantUserIds | Array of Int | [10001,10002] | 群成员 ID。直播群会返回群主 ID。 |
| OwnerUserId | Int | 100001 | 群主 UserId |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段 |
{
"AppId": 000000,
"Description": "Your_Description",
"AvatarUrl": "http://xxx.com",
"Name": "Conversation",
"InboxType": 0,
"ParticipantUserIds": [
10001,
10002
],
"OwnerUserId": 10001,
"Ext": {
"key":"value"
}
}
json若想修改 IM 服务端传入的ValidParticipantUserIds,InValidParticipantUserIds、Name 、AvatarUrl 、Description 或 Ext 的值,可在 Response 中传入,否则这些值均不传或传 null。
InValidParticipantUserIds 暂时无意义,但建议设置。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示创建群聊失败 |
| CheckMessage | String | / | 消息发送失败原因 |
| ValidParticipantUserIds | Array of Int | [10001,10002] | 合法群成员 ID |
| InValidParticipantUserIds | Array of Int | [10003,10004] | 不合法群成员 ID |
| Name | String | Conversation | 群名 |
| AvatarUrl | String | http://xxx.com | 群头像 url |
| Description | String | Your_Description | 群描述 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。 |
{
"CheckCode": 0,
"CheckMessage": "",
"ValidParticipantUserIds":[10001,10002,10004],
"InValidParticipantUserIds":[10003],
"Name":"Newconversation",
"AvatarUrl":"http://xxx.xxx.com",
"Description":"new_Description",
"Ext": {
"key":"value"
}
}
jsonBeforeAddParticipant
添加群成员前。
该回调仅支持普通群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ParticipantUserIds | Array of Int | [10001,10002] | 群成员 ID |
| Operator | Int | 100001 | 操作人 UserId |
{
"AppId": 000000,
"ConversationShortId": 000001,
"InboxType": 0,
"ParticipantUserIds": [
10009
],
"Operator": 100001
}
json若想修改 IM 服务端传入的ValidParticipantUserIds 或 InValidParticipantUserIds的值,可在 Response 中传入,否则这些值均不传或传 null。
InValidParticipantUserIds 暂时无意义,但建议设置。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示添加群成员失败 |
| CheckMessage | String | / | 操作失败原因 |
| ValidParticipantUserIds | Array of Int | [10001,10002] | 合法群成员 ID |
| InValidParticipantUserIds | Array of Int | [10003,10004] | 不合法群成员 ID |
{
"CheckCode": 0,
"CheckMessage": "",
"ValidParticipantUserIds":[10010],
"InValidParticipantUserIds":[10003]
jsonBeforeCreateSingleConversation
创建单聊前。
该回调仅支持单聊。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| OwnerUserId | Int | 10001 | 发起群聊 UserId |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ParticipantUserIds | Array of Int | [10001,10002] | 群成员 ID |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段。 |
{
"AppId": 000000,
"OwnerUserId": 10001,
"ParticipantUserIds": [
10001,
10002
]
"Ext": {
"key":"value"
}
}
json若想修改 IM 服务端传入的Ext 的值,可在 Response 中传入,否则这些值均不传或传 null。
InValidParticipantUserIds 暂时无意义,但建议设置。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示创建单聊失败 |
| CheckMessage | String | / | 操作失败原因 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。 |
{
"CheckCode": 0,
"CheckMessage": "",
"Ext": {
"key":"value"
}
jsonBeforeRemoveParticipant
移除群聊用户前。
该回调仅支持普通群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ParticipantUserIds | Array of Int | [10002] | 移除群聊用户 UserId |
| Operator | Int | 100001 | 操作人 UserId |
{
"AppId": 000000,
"ConversationShortId": 000001,
"ParticipantIds": [
10002
],
"Operator": 100001
}
json若想修改 IM 服务端传入的ValidParticipantUserIds 或 InValidParticipantUserIds的值,可在 Response 中传入,否则这些值均不传或传 null。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示移除群聊用户失败 |
| CheckMessage | String | / | 操作失败原因 |
| ValidParticipantUserIds | Array of Int | [10002] | 移除群聊用户 UserId |
| InValidParticipantUserIds | Array of Int | [10003,10004] | 不合法群成员 ID。暂时无意义,但推荐设置 |
{
"CheckCode": 0,
"CheckMessage": ""
"ValidParticipantUserIds":[10002],
"InValidParticipantUserIds":[10003]
}
jsonBeforeUpdateConversation
更新群聊信息前。
该回调支持单聊、普通群和直播群。
若某个字段并没有修改,则
EventData中并不会出现该字段。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型。
|
| Description | String | Your_Description | 群描述 |
| AvatarUrl | String | http://xxx.com | 群头像 url |
| Name | String | Conversation | 群名 |
| Notice | String | Your_Notice | 群公告 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段。 |
| Operator | Int | 100001 | 操作人 UserId |
{
"AppId": 000000,
"ConversationShortId": 000001,
"ConversationType": 2,
"Description": "000001",
"AvatarUrl": http://xxx.com,
"Name": "Conversation",
"Notice": Your_Notice,
"Ext": {
"key":"value"
}
"Operator":100001
}
json若想修改 IM 服务端传入的Name、Description、AvatarUrl、Notice 或 Ext的值,可在 Response 中传入,否则这些值均不传或传 null。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示更新群聊信息失败 |
| CheckMessage | String | / | 操作失败原因 |
| Name | String | Conversation | 群名 |
| Description | String | Your_Description | 群描述 |
| AvatarUrl | String | http://xxx.com | 群头像 url |
| Notice | String | Your_Notice | 群公告 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段。若客户端与服务端均传入该值,若 key 值相同,则以服务端为准。若 key 值不同,则合并展示。 |
{
"CheckCode": 0,
"CheckMessage": ""
"Name":"New_Conversation",
"Description":"New_Description",
"AvatarUrl":"http://xxx.xxx.com",
"Notice":"New_Notice",
"Ext": {
"key":"value"
}
}
jsonBeforeUpdateParticipant
修改群成员详情前。
该回调仅支持普通群和直播群。
若某个字段并没有修改,则
EventData中并不会出现该字段。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 2 | 会话类型。
|
| Operator | Int | 100001 | 操作人 UserId |
| UpdateParticipants | Array of UpdateParticipant | / | 群成员修改详情 |
UpdateParticipant
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| ParticipantUserId | Int | 10001 | 修改群成员 UserId |
| Role | Int | 0 | 群成员身份。
|
| NickName | String | Your_NickName | 群成员昵称。 |
| AvatarUrl | String | http://xxx.com | 群成员头像 url |
| MarkTypes | Array of String | ["mark1","mark2"] | 群成员标记,仅直播群在线成员返回。 |
{
"AppId": 000000,
"ConversationShortId": 000001,
"ConversationType": 2,
"Operator": 10002,
"UpdateParticipants":[{
"ParticipantUserId":10006,
"Role": 2,
"NickName":"Your_NickName",
"AvatarUrl":"http://xxx.com",
"MarkTypes":["mark1","mark2"]
}]
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示修改群成员详情失败 |
| CheckMessage | String | / | 操作失败原因 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonBeforeUpdateSetting
修改用户对群设置前。
该回调支持单聊和普通群。
若某个字段并没有修改,则
EventData中并不会出现该字段。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型。
|
| IsMute | Bool | true | 是否免打扰 |
| IsSetTop | Bool | true | 是否置顶 |
| IsSetFavorite | Bool | true | 是否收藏 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段。 |
| ParticipantUserId | Int | 10001 | 修改用户 UserId |
{
"AppId": 000000,
"ConversationShortId": 000001,
"ConversationType": 2,
"IsMute": true
"IsSetTop":true
"IsSetFavorite" : true
"Ext": {
"key":"value"
}
"ParticipantUserId": 10001
}
json若想修改 IM 服务端传入的Ext的值,可在 Response 中传入,否则这些值均不传或传 null。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示修改用户对群设置失败 |
| CheckMessage | String | / | 操作失败原因 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。 |
{
"CheckCode": 0,
"CheckMessage": "",
"Ext": {
"key":"value"
}
}
jsonAfterRemoveParticipant
群成员离开会话后,包括主动离开会话和被移除会话。
该回调支持普通群和直播群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 2 | 会话类型。
|
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ParticipantUserIds | Array of Int | [10001] | 群成员 ID |
| Operator | Int | 100001 | 操作人 UserId |
{
"AppId":000000,
"ConversationShortId":000001,
"ConversationType":100,
"InboxType":0,
"ParticipantUserIds":[
10001
],
"Operator":100001
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonAfterAddParticipant
群成员加入会话后
该回调支持普通群和直播群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 2 | 会话类型。
|
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| Operator | Int | 100001 | 操作人 UserId |
| ParticipantUserIds | Array of Int | [10001] | 群成员 ID |
| Participants | Array of Participant | 进群成员详情 |
Participant
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| ParticipantUserId | Int | 10001 | 进群成员 UserId |
| Level | Int | 0 | 成员等级。直播群不会返回该参数。 |
| NickName | String | Your_NickName | 成员昵称。直播群不会返回该参数。 |
| Role | Int | 0 | 成员身份。
|
| Ext | map-key(string)-value(string) | {"key":"value"} | 成员的扩展字段 |
{
"AppId":000000,
"ConversationShortId":000001,
"ConversationType":2,
"InboxType":0,
"Operator":10001,
"Participants":[
{
"ParticipantUserId":10001,
"Level":0,
"NickName":"Your_NickName",
"Role":1,
"Ext":{"key":"value"}
}
]
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonParticipantStateChange
直播群成员在群状态发生变化。
该回调仅支持直播群。
该回调只会在以下两种情况下触发:
若同一个登录用户使用多台设备同时加入到同一个直播间时,只有当所有设备同时掉线才会触发掉线事件。当任一设备恢复上线时会触发该回调,后续其他设备登录不会触发该回调。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 100 | 会话类型。100:直播群。 |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ParticipantUserIds | Array of Int | [10001] | 群成员 ID |
| StateChangeType | Int | 1 | 状态更改类型
|
{
"AppId":000000,
"ConversationShortId":000001,
"ConversationType":100,
"InboxType":0,
"ParticipantUserIds":[
10003
],
"StateChangeType":2
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonOnlineStateChange
用户状态发生变化。
该回调与会话无关,为用户自身在应用中状态。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| Events | Array of Event | 事件详情 |
Event
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| UserId | Int | 10001 | 用户 UserId |
| EventTime | Int | 1683357800192 | 上下线事件发生的时间戳,单位为毫秒 |
| EventType | Int | 1 | 用户状态:0:上线 1:下线 |
| ConnId | String | Your_ConnId | 连接的唯一标识 |
| DeviceId | Int | 10002 | 设备 ID |
{
"AppId":000000,
"Events":[
{
"AppId":000000,
"UserId":10001,
"EventTime":1683357800192,
"EventType":1,
"ConnId":"Your_ConnId",
"DeviceId":10002
}
]
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonAfterCreateConversation
会话创建后。
该回调支持单聊、普通群和直播群。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型
|
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| Description | String | Your_Description | 群描述 |
| AvatarUrl | String | http://xxx.com | 群头像 url |
| Name | String | Conversation | 群名 |
| CreateTime | Int | 1666598278 | 群聊创建时间戳,单位为秒 |
| Ext | map-key(string)-value(string) | {"key":"value"} | 会话的扩展字段 |
| OwnerUserId | Int | 100001 | 群主 UserId |
| ToUserId | Int | 100002 |
|
{
"AppId":000000,
"ConversationShortId":000001,
"ConversationType":100,
"InboxType":0,
"Description": "Your_Description",
"AvatarUrl": "http://xxx.com",
"Name": "Conversation",
"CreateTime": 1666598278,
"Ext": {
"key":"value"
"OwnerUserId": 10001,
"ToUserId": 000001
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonAfterPush
将客户端发送的消息在线推送后
该回调支持单聊和普通群
普通群中,消息在线推送给所有群成员,每个群成员均会触发一次回调。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| ToId | Int | 100002 | 接受方 UserId |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| MessageBody | MessageBody | / | 消息详情 |
| RefMsgInfo | RefMsgInfo | / | 引用消息详情 |
| SuccessPushResult | SuccessPushResult | / | 推送成功平台,仅在推送成功时有值 |
| IsPushSuccess | Bool | false | 消息推送是否成功。
|
| IsMute | Bool | false | 接受方是否开启了免打扰。
|
MessageBody
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| ConversationType | Int | 1 | 会话类型
|
| Content | String | Your_Content | 消息内容 |
| ConversationShortId | Int | 000001 | 会话 ID |
| MsgType | Int | 10001 | 消息类型。
|
| Sender | Int | 000010 | 消息发送人 UserId |
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段 |
| MessageId | Int | 000012 | 消息 ID |
RefMsgInfo
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| ReferenceMessageId | Int | 000013 | 消息 ID |
| Hint | String | [图片] | 消息引用时展示的文本内容 |
| ReferenceMessageType | Int | 10001 | 消息类型。
|
| Status | Int | 0 | 消息状态。枚举值为 {0,3,4}。
|
SuccessPushResult
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Platform | String | Platform_Android | 消息推送平台。
|
| ConnId | String | Your_ConnId | 连接的唯一标识 |
{
"AppId":000000,
"ToId":100002,
"InboxType":0,
"MessageBody":{
"ConversationType":2,
"Content":"Your_Content",
"ConversationShortId":000001,
"MsgType":10001,
"Sender":000010,
"Ext":{
"key":"value"
},
"MessageId":000012
},
"RefMsgInfo":{
"ReferenceMessageId":000013,
"Hint":"[图片]",
"ReferenceMessageType":10001,
"Status":0
},
"SuccessPushResult":[
{
"Platform":"Platform_IOS",
"ConnId":"ConnId_1"
},
{
"Platform":"Platform_Web",
"ConnId":"ConnId_2"
}
],
"IsPushSuccess":false,
"IsMute":false
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonAfterSendMessage
消息发送成功且存入数据库后
该回调支持单聊、普通群和直播群
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| FromId | Int | 100002 | 发送方 UserId |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| MessageBody | MessageBody | / | 消息详情 |
| RefMsgInfo | RefMsgInfo | / | 引用消息详情 |
| ToId | Int | 000010 |
|
| Header | map-key(string)-value(string) | {"IP":"xxx.xxx.xxx.xxx"} | 消息发送方的元信息(通过OpenAPI发送的消息元信息的各字段均为空),目前已有的key为:
|
MessageBody
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Content | String | Your_Content | 消息内容 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型。
|
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段 |
| MsgType | Int | 10001 | 消息类型。
|
| Sender | Int | 000010 | 消息发送人 UserId |
| MessageId | Int | 0000111 | 消息 ID |
| IndexInConversation | Int | 1111111222 | 消息在会话中的位置。
|
RefMsgInfo
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Hint | String | 1 | 消息引用时展示的文本内容 |
| ReferenceMessageId | Int | 0000122 | 引用消息的消息 ID |
| ReferenceMessageType | Int | 10001 | 引用消息的消息类型。
|
| Status | Int | 0 | 引用消息的消息状态。枚举值为 {0,3,4}。
|
{
"AppId": 000000,
"FromId": 100002,
"InboxType": 0,
"MessageBody": {
"Content": "Your_Content",
"ConversationShortId": 000001,
"ConversationType": 1,
"Ext": {
"key":"value"
},
"MsgType": 10001,
"Sender": 000010,
"MessageId": 0000111,
"IndexInConversation": 1111111222
},
"RefMsgInfo": {
"Hint": "1",
"ReferenceMessageId": 0000122,
"ReferenceMessageType": 10001,
"Status": 0
},
"ToId": 000010,
"Header":{
"IP": "180.184.92.210",
"DevicePlatform": "android",
"OsVersion": "10",
"DeviceType": "ANA-AN00"
}
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
jsonAfterSetProperty
消息属性修改后。
该回调支持单聊和群聊。
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| AppId | Int | 000000 | 应用的唯一标志 |
| InboxType | Int | 0 | 信箱,用于逻辑隔离 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型。
|
| MessageBody | MessageBody | / | 修改后的消息详情 |
| ModifyProperties | Array of ModifyProperty | / | 本次修改内容详情 |
| Operator | Int | 100001 | 操作人 UserId |
MessageBody
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| ConversationType | Int | 1 | 会话类型。
|
| Content | String | Your_Content | 消息内容 |
| ConversationShortId | Int | 000001 | 会话 ID |
| MsgType | Int | 10001 | 消息类型。
|
| Sender | Int | 000010 | 消息发送人 UserId |
| Ext | map-key(string)-value(string) | {"key":"value"} | 消息的扩展字段 |
| MessageId | Int | 0000111 | 消息 ID |
| IndexInConversation | Int | 1111111222 | 消息在会话中的位置。单聊和普通群聊中,IndexInConversation 约等于消息发送时间戳。 |
| Property | map-key(string)-value([]PropertyItem) | / | 修改后的消息属性 |
PropertyItem
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Operator | Int | 100001 | 操作人 UserId |
| CreateTime | Int | 1666598278 | 操作时间,单位为秒 |
| IdempotentId | String | Your_IdempotentId | PropertyItem 唯一标识 |
| Value | String | Your_Value | PropertyItem 内容 |
ModifyProperty
| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Key | String | Your_key | 修改消息属性对应的 Key 值 |
| Op | Int | 0 | 消息属性修改操作。
|
| Value | String | Your_value | key 中数组中内其中一项的 value |
| IdempotentId | String | Your_IdempotentId | PropertyItem 唯一标识 |
{
"AppId":000000,
"InboxType":0,
"ConversationShortId":000001,
"ConversationType":2,
"MessageBody":{
"ConversationType":2,
"Content":"{"text":"text"}",
"ConversationShortId":000001,
"MsgType":10001,
"Sender":000010,
"Ext":{
"key":value"
},
"MessageId":0000111,
"IndexInConversation":1111111222,
"Property":{
"[可爱]":[
{
"Operator":10002,
"CreateTime":1703058396,
"IdempotentId":"[可爱]10002[可爱]",
"Value":"[可爱]"
}
]
}
},
"ModifyProperties":[
{
"Key":"[可爱]",
"Op":0,
"Value":"[可爱]",
"IdempotentId":"[可爱]10002[可爱]"
}
],
"Operator":10002
}
json| 参数名 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| CheckCode | Int | 0 | 若非 0,表示处理失败 |
| CheckMessage | String | / | 错误详细信息 |
{
"CheckCode": 0,
"CheckMessage": ""
}
json