31 lines
809 B
Go
31 lines
809 B
Go
package dingdingapi
|
|
|
|
import "strings"
|
|
|
|
func (a *API) CorpAsyncSend(userIDList, deptIDList []string, isToAllUser bool, msg map[string]interface{}) (err error) {
|
|
params := map[string]interface{}{
|
|
"agent_id": a.agentID,
|
|
"msg": msg,
|
|
}
|
|
if len(userIDList) > 0 {
|
|
params["userid_list"] = strings.Join(userIDList, ",")
|
|
}
|
|
if len(deptIDList) > 0 {
|
|
params["dept_id_list"] = strings.Join(deptIDList, ",")
|
|
}
|
|
if isToAllUser {
|
|
params["to_all_user"] = isToAllUser
|
|
}
|
|
_, err = a.AccessAPI("topapi/message/corpconversation/asyncsend_v2", nil, params)
|
|
return err
|
|
}
|
|
|
|
func (a *API) CorpAsyncSendSimple(userID, content string) (err error) {
|
|
return a.CorpAsyncSend([]string{userID}, nil, false, map[string]interface{}{
|
|
"msgtype": "text",
|
|
"text": map[string]interface{}{
|
|
"content": content,
|
|
},
|
|
})
|
|
}
|