mirror of
https://github.com/silenceper/wechat.git
synced 2026-11-16 05:12:03 +08:00
feat(work): 企业微信接口增加 (#617)
* feat(work): 企业微信接口增加 群机器人 查询成员信息 * 变更 * fix(fix): 修复lint 报错 * fix: 删除注释多余字符
This commit is contained in:
1 parent
9ad8981ff0
commit
5e0c31bfa9
7 files changed
+296
-1
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package robot
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/silenceper/wechat/v2/util"
|
||||
)
|
||||
|
||||
const (
|
||||
// WebhookSendURL 机器人发送群组消息
|
||||
WebhookSendURL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=%s"
|
||||
)
|
||||
|
||||
// RobotBroadcast 群机器人消息发送
|
||||
// @see https://developer.work.weixin.qq.com/document/path/91770
|
||||
func (r *Client) RobotBroadcast(webhookKey string, options interface{}) (info util.CommonError, err error) {
|
||||
var data []byte
|
||||
if data, err = util.PostJSON(fmt.Sprintf(WebhookSendURL, webhookKey), options); err != nil {
|
||||
return
|
||||
}
|
||||
if err = json.Unmarshal(data, &info); err != nil {
|
||||
return
|
||||
}
|
||||
if info.ErrCode != 0 {
|
||||
return info, err
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
Reference in new issue
Block a user