mirror of
				https://github.com/openimsdk/open-im-server.git
				synced 2025-11-04 19:32:17 +08:00 
			
		
		
		
	feature: add webhook AttentionIds
This commit is contained in:
		
							parent
							
								
									d6606152ee
								
							
						
					
					
						commit
						61cb960916
					
				@ -13,6 +13,9 @@ afterUpdateUserInfoEx:
 | 
				
			|||||||
afterSendSingleMsg:
 | 
					afterSendSingleMsg:
 | 
				
			||||||
  enable: false
 | 
					  enable: false
 | 
				
			||||||
  timeout: 5
 | 
					  timeout: 5
 | 
				
			||||||
 | 
					  # Only the senID/recvID specified in attentionIds will send the callback
 | 
				
			||||||
 | 
					  # if not set, all user messages will be callback
 | 
				
			||||||
 | 
					  attentionIds: []
 | 
				
			||||||
beforeSendGroupMsg:
 | 
					beforeSendGroupMsg:
 | 
				
			||||||
  enable: false
 | 
					  enable: false
 | 
				
			||||||
  timeout: 5
 | 
					  timeout: 5
 | 
				
			||||||
 | 
				
			|||||||
@ -83,6 +83,11 @@ func (m *msgServer) webhookAfterSendSingleMsg(ctx context.Context, after *config
 | 
				
			|||||||
	if msg.MsgData.ContentType == constant.Typing {
 | 
						if msg.MsgData.ContentType == constant.Typing {
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						// According to the attentionIds configuration, only some users are sent
 | 
				
			||||||
 | 
						attentionIds := after.AttentionIds
 | 
				
			||||||
 | 
						if attentionIds != nil && !datautil.Contain(msg.MsgData.RecvID, attentionIds...) && !datautil.Contain(msg.MsgData.SendID, attentionIds...) {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	cbReq := &cbapi.CallbackAfterSendSingleMsgReq{
 | 
						cbReq := &cbapi.CallbackAfterSendSingleMsgReq{
 | 
				
			||||||
		CommonCallbackReq: toCommonCallback(ctx, msg, cbapi.CallbackAfterSendSingleMsgCommand),
 | 
							CommonCallbackReq: toCommonCallback(ctx, msg, cbapi.CallbackAfterSendSingleMsgCommand),
 | 
				
			||||||
		RecvID:            msg.MsgData.RecvID,
 | 
							RecvID:            msg.MsgData.RecvID,
 | 
				
			||||||
 | 
				
			|||||||
@ -339,8 +339,9 @@ type BeforeConfig struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type AfterConfig struct {
 | 
					type AfterConfig struct {
 | 
				
			||||||
	Enable  bool `mapstructure:"enable"`
 | 
						Enable       bool  `mapstructure:"enable"`
 | 
				
			||||||
	Timeout int  `mapstructure:"timeout"`
 | 
						Timeout      int   `mapstructure:"timeout"`
 | 
				
			||||||
 | 
						AttentionIds []string `mapstructure:"attentionIds"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type Share struct {
 | 
					type Share struct {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user