[FEATURE REQUEST] Send a message to the specified member in the group, other members will not receive this message
Why this feature?
我想使用Server API给群内指定成员发送消息(事件通知),但是好像没有一个适合的方法 如果使用私聊发送会产生新的会话 使用/msg/send_business_notification比较符合需求,但是这个似乎不能持久化,用户不在线,这个消息就丢失了
Suggested Solution
。。。
Additional Information
No response
Hello! Thank you for filing an issue.
If this is a bug report, please include relevant logs to help us debug the problem.
Join slack 🤖 to connect and communicate with our developers.
能否给/msg/send_business_notification增加个选项,用来支持离线分发
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Can you add an option to /msg/send_business_notification to support offline distribution?
@zengyun261 兄弟 我是一个读过源码的路人,看你说的这个方法里的实现是
sendMsgReq := msg.SendMsgReq{
MsgData: &sdkws.MsgData{
SendID: req.SendUserID,
RecvID: req.RecvUserID,
Content: []byte(jsonutil.StructToJsonString(&sdkws.NotificationElem{
Detail: jsonutil.StructToJsonString(&struct {
Key string `json:"key"`
Data string `json:"data"`
}{Key: req.Key, Data: req.Data}),
})),
MsgFrom: constant.SysMsgType,
ContentType: constant.BusinessNotification,
SessionType: constant.SingleChatType,
CreateTime: timeutil.GetCurrentTimestampByMill(),
ClientMsgID: idutil.GetMsgIDByMD5(mcontext.GetOpUserID(c)),
Options: config.GetOptionsByNotification(config.NotificationConfig{
IsSendMsg: false,
ReliabilityLevel: 1,
UnreadCount: false,
}),
},
}
respPb, err := m.Client.SendMsg(c, &sendMsgReq)
我觉得你要是着急解决的话,可以试着自己手动调用 send_msg,传参和上面的类似,然后只用把 ReliabilityLevel 改成 2 就行了
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@zengyun261 Brother, I am a passerby who has read the source code. The implementation of the method you mentioned is
sendMsgReq := msg.SendMsgReq{
MsgData: &sdkws.MsgData{
SendID: req.SendUserID,
RecvID: req.RecvUserID,
Content: []byte(jsonutil.StructToJsonString(&sdkws.NotificationElem{
Detail: jsonutil.StructToJsonString(&struct {
Key string json:"key"
Data string json:"data"
}{Key: req.Key, Data: req.Data}),
})),
MsgFrom: constant.SysMsgType,
ContentType: constant.BusinessNotification,
SessionType: constant.SingleChatType,
CreateTime: timeutil.GetCurrentTimestampByMill(),
ClientMsgID: idutil.GetMsgIDByMD5(mcontext.GetOpUserID(c)),
Options: config.GetOptionsByNotification(config.NotificationConfig{
IsSendMsg: false,
ReliabilityLevel: 1,
UnreadCount: false,
}),
},
}
respPb, err := m.Client.SendMsg(c, &sendMsgReq)
I think if you are in a hurry to solve it, you can try calling send_msg manually. The parameters are similar to the above, and then just change the ReliabilityLevel to 2.
This feature is already supported in the commercial version.