BeforeSendMessage
EventType

BeforeSendMessage

事件详情

消息发送前。

EventData
参数名类型示例值描述
AppIdInt000000应用的唯一标志
InboxTypeInt0信箱,用于逻辑隔离
MessageBodyMessageBody/消息详情
RefMsgInfoRefMsgInfo/引用消息详情
ToIdInt000010
  • 单聊:另一人 UserId。
  • 群聊:群聊 Id。

MessageBody

参数名类型示例值描述
ContentStringYour_Content消息内容
ConversationShortIdInt000001会话 ID
ConversationTypeInt1会话类型
  • 1:单聊。
  • 2:群聊。
Extmap-key(string)-value(string){"key":"value"}会话的扩展字段
MsgTypeInt10001消息类型。
  • 10001:文本。
  • 10003:图片。
  • 10004:视频
  • 10005:文件
  • 10006:音频
  • 10012:自定义消息
SenderInt000010消息发送人 UserId
MessageIdInt7157538953100462124消息 ID

RefMsgInfo

参数名类型示例值描述
ContentStringYour_Content被引用的消息内容
HintString[图片]消息引用时展示的文本内容
InvisibleUsersArray of Int[111111]消息不可见群成员列表。
VisibleUsersArray of Int[111111]消息可见群成员列表
ReferenceMessageIdInt7157538953100462124消息 ID
ReferenceMessageTypeInt10001消息类型。
  • 10001:文本。
  • 10003:图片。
  • 10004:视频
  • 10005:文件
  • 10006:音频
  • 10012:自定义消息
StatusInt0消息状态,取值为0,表示消息可见。
参数示例
{
  "AppId": 000000, 
  "InboxType": 0, 
  "MessageBody": {
    "Content": "Your_Content",
    "ConversationShortId": 000001, 
    "ConversationType": 2, 
    "Ext": { 
      "key":"value"
    },
    "MsgType": 10001, 
    "Sender": 000010, 
    "MessageId": 7157538953100462124
  },
  "RefMsgInfo": { 
    "Content": "Your_Content", 
    "Hint": "[图片]", 
    "InvisibleUsers": [], 
    "VisibleUsers": [], 
    "ReferenceMessageId": 7172170746108625159, 
    "ReferenceMessageType": 10001, 
    "Status": 0  
  },
  "ToId": 000011 
}
json
Response

若想修改 IM 服务端传入的Ext,Content、InvisibleUsers 或 VisibleUsers 的值,可在 Response 中传入,否则这些值均不传或传 null。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
MessageBodyMessageBody/消息详情

MessageBody

参数名类型示例值描述
Extmap-key(string)-value(string){"key":"value"}会话的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。
ContentStringYour_Content消息内容
InvisibleUsersArray of Int[111111]消息不可见群成员列表。
VisibleUsersArray of Int[111111]消息可见群成员列表
参数示例
{
    "CheckCode":0, 
    "CheckMessage":"" 
    "MessageBody":{
        "Ext":{}, 
        "Content":"",
        "VisibleUsers":[], 
        "InVisibleUsers":[] 
    }
}
json
BeforeCreateConversation
EventType

BeforeCreateConversation

事件详情

创建群聊前。

EventData
参数名类型示例值描述
AppIdInt000000应用的唯一标志
DescriptionStringYour_Description群描述
AvatarUrlStringhttp://xxx.com群头像 url
NameStringConversation群名
InboxTypeInt0信箱,用于逻辑隔离
ParticipantUserIdsArray of Int[10001,10002]群成员 ID
OwnerUserIdInt100001群主 UserId
Extmap-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
Response

若想修改 IM 服务端传入的ValidParticipantUserIds,InValidParticipantUserIds、Name 、AvatarUrl 、Description 或 Ext 的值,可在 Response 中传入,否则这些值均不传或传 null。

InValidParticipantUserIds 暂时无意义,但建议设置。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
ValidParticipantUserIdsArray of Int[10001,10002]合法群成员 ID
InValidParticipantUserIdsArray of Int[10003,10004]不合法群成员 ID
NameStringConversation群名
AvatarUrlStringhttp://xxx.com群头像 url
DescriptionStringYour_Description群描述
Extmap-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"
    }
}
json
BeforeAddParticipant
EventType

BeforeAddParticipant

事件详情

添加群成员前。

EventData
参数名类型示例值描述
AppIdInt000000应用的唯一标志
ConversationShortIdInt000001会话 ID
InboxTypeInt0信箱,用于逻辑隔离
ParticipantUserIdsArray of Int[10001,10002]群成员 ID
OperatorInt100001操作人 UserId
参数示例
{
  "AppId": 000000, 
  "ConversationShortId": 000001, 
  "InboxType": 0, 
  "ParticipantUserIds": [ 
    10009
  ],
  "Operator": 100001 
}
json
Response

若想修改 IM 服务端传入的ValidParticipantUserIds 或 InValidParticipantUserIds的值,可在 Response 中传入,否则这些值均不传或传 null。

InValidParticipantUserIds 暂时无意义,但建议设置。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
ValidParticipantUserIdsArray of Int[10001,10002]合法群成员 ID
InValidParticipantUserIdsArray of Int[10003,10004]不合法群成员 ID
参数示例
{
    "CheckCode": 0,
    "CheckMessage": "",
    "ValidParticipantUserIds":[10010], 
    "InValidParticipantUserIds":[10003] 
json
BeforeCreateSingleConversation
EventType

BeforeCreateSingleConversation

事件详情

添加群成员前。

EventData
参数名类型示例值描述
AppIdInt000000应用的唯一标志
OwnerUserIdInt10001发起群聊 UserId
InboxTypeInt0信箱,用于逻辑隔离
ParticipantUserIdsArray of Int[10001,10002]群成员 ID
Extmap-key(string)-value(string){"key":"value"}会话的扩展字段。
参数示例
{
  "AppId": 000000, 
  "OwnerUserId": 10001, 
  "ParticipantUserIds": [ 
    10001,
    10002
  ]
  "Ext": { 
    "key":"value"
	} 
}
json
Response

若想修改 IM 服务端传入的Ext 的值,可在 Response 中传入,否则这些值均不传或传 null。

InValidParticipantUserIds 暂时无意义,但建议设置。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
Extmap-key(string)-value(string){"key":"value"}会话的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。
参数示例
{
    "CheckCode": 0,
    "CheckMessage": "",
    "Ext": { 
      "key":"value"
    }
json
BeforeRemoveParticipant
EventType

BeforeRemoveParticipant

事件详情

移除群聊用户前。

EventData
参数名类型示例值描述
AppIdInt000000应用的唯一标志
ConversationShortIdInt000001会话 ID
ParticipantUserIdsArray of Int[10002]移除群聊用户 UserId
OperatorInt100001操作人 UserId
参数示例
{
  "AppId": 000000,
  "ConversationShortId": 000001, 
  "ParticipantIds": [ 
    10002
  ],
  "Operator": 100001 
}
json
Response

若想修改 IM 服务端传入的ValidParticipantUserIds 或 InValidParticipantUserIds的值,可在 Response 中传入,否则这些值均不传或传 null。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
ValidParticipantUserIdsArray of Int[10002]移除群聊用户 UserId
InValidParticipantUserIdsArray of Int[10003,10004]不合法群成员 ID。暂时无意义,但推荐设置
参数示例
{
    "CheckCode": 0,
    "CheckMessage": ""
    "ValidParticipantUserIds":[10002],
    "InValidParticipantUserIds":[10003]
}
json
BeforeUpdateConversation
EventType

BeforeUpdateConversation

事件详情

更新群聊信息前。

EventData

若某个字段并没有修改,则 EventData 中并不会出现该字段。

参数名类型示例值描述
AppIdInt000000应用的唯一标志
ConversationShortIdInt000001会话 ID
ConversationTypeInt1会话类型。
  • 1:单聊
  • 2:群聊
DescriptionStringYour_Description群描述
AvatarUrlStringhttp://xxx.com群头像 url
NameStringConversation群名
NoticeStringYour_Notice群公告
Extmap-key(string)-value(string){"key":"value"}会话的扩展字段。
OperatorInt100001操作人 UserId
参数示例
{
  "AppId": 000000,
  "ConversationShortId": 000001, 
  "ConversationType": 2,   
  "Description": "000001",
  "AvatarUrl": http://xxx.com,
  "Name": "Conversation",
  "Notice": Your_Notice,
	"Ext": { 
	  "key":"value"
	}
  "Operator":100001
}
json
Response

若想修改 IM 服务端传入的Name、Description、AvatarUrl、Notice 或 Ext的值,可在 Response 中传入,否则这些值均不传或传 null。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
NameStringConversation群名
DescriptionStringYour_Description群描述
AvatarUrlStringhttp://xxx.com群头像 url
NoticeStringYour_Notice群公告
Extmap-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"
		}
}
json
BeforeUpdateParticipant
EventType

BeforeUpdateParticipant

事件详情

修改群成员详情前。

EventData

若某个字段并没有修改,则 EventData 中并不会出现该字段。

参数名类型示例值描述
NickNameStringYour_NickName成员昵称
AppIdInt000000应用的唯一标志
ConversationShortIdInt000001会话 ID
ConversationTypeInt1会话类型。
  • 1:单聊
  • 2:群聊
OperatorInt100001操作人 UserId
RoleInt0成员身份。
  • 0: 普通成员。
  • 1: 群主。
  • 2:群管理员。
ParticipantuserIdInt10001修改用户 UserId
参数示例
{
  "NickName": "Your_NickName", 
  "AppId": 000000,
  "ConversationShortId": 000001,
  "ConversationType": 2,
  "Operator": 10002, 
  "Role": 2, 
  "ParticipantuserId": 10001 
}
json
Response
参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
参数示例
{
    "CheckCode": 0,
    "CheckMessage": ""
}
json
BeforeUpdateSetting
EventType

BeforeUpdateSetting

事件详情

修改用户对群设置前。

EventData

若某个字段并没有修改,则 EventData 中并不会出现该字段。
| 参数名 | 类型 | 示例值 | 描述 |
| --- | --- | --- | --- |
| AppId | Int | 000000 | 应用的唯一标志 |
| ConversationShortId | Int | 000001 | 会话 ID |
| ConversationType | Int | 1 | 会话类型。

  • 1:单聊
  • 2:群聊
|
| 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
Response

若想修改 IM 服务端传入的Ext的值,可在 Response 中传入,否则这些值均不传或传 null。

参数名类型示例值描述
CheckCodeInt0若非 0,表示发送消息失败
CheckMessageString/消息发送失败原因
Extmap-key(string)-value(string){"key":"value"}会话的扩展字段。若 EvenData 与 Response 均传入该值,若 key 值相同,最终则以Response 传入为准。若 key 值不同,则最终合并展示。
参数示例
{
    "CheckCode": 0,
    "CheckMessage": "",
    "Ext": { 
      "key":"value"
    }
}
json