|
@@ -139,6 +139,72 @@ func (h *Hook) TriggerChatroomPush(wxWxid string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+// TriggerCustomerPushTask 刷新企微联系人
|
|
|
+func (h *Hook) TriggerCustomerPushTask(wxWxid string) error {
|
|
|
+ conn, err := h.connWorkPhone()
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("TriggerCustomerPushTask failed")
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ defer func(conn *websocket.Conn) {
|
|
|
+ err = conn.Close()
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("TriggerCustomerPushTask failed")
|
|
|
+ }
|
|
|
+ }(conn)
|
|
|
+
|
|
|
+ message := map[string]interface{}{
|
|
|
+ "MsgType": "TriggerCustomerPushTask",
|
|
|
+ "Content": map[string]interface{}{
|
|
|
+ "WxId": wxWxid,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ transportMessageJSON, err := json.Marshal(message)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ // 发送 JSON 消息
|
|
|
+ err = conn.WriteMessage(websocket.TextMessage, transportMessageJSON)
|
|
|
+ if err != nil {
|
|
|
+ return fmt.Errorf("failed to send message: %v", err)
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// TriggerConversationPushTask 刷新企微群组
|
|
|
+func (h *Hook) TriggerConversationPushTask(wxWxid string) error {
|
|
|
+ conn, err := h.connWorkPhone()
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("TriggerConversationPushTask failed")
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ defer func(conn *websocket.Conn) {
|
|
|
+ err = conn.Close()
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("TriggerConversationPushTask failed")
|
|
|
+ }
|
|
|
+ }(conn)
|
|
|
+
|
|
|
+ message := map[string]interface{}{
|
|
|
+ "MsgType": "TriggerConversationPushTask",
|
|
|
+ "Content": map[string]interface{}{
|
|
|
+ "WxId": wxWxid,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ transportMessageJSON, err := json.Marshal(message)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ // 发送 JSON 消息
|
|
|
+ err = conn.WriteMessage(websocket.TextMessage, transportMessageJSON)
|
|
|
+ if err != nil {
|
|
|
+ return fmt.Errorf("failed to send message: %v", err)
|
|
|
+ }
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
func (h *Hook) AddFriendInChatRoom(ChatRoomId, wxWxid, friendId, desc string) error {
|
|
|
conn, err := h.connWorkPhone()
|
|
|
if err != nil {
|