SendCustomerText
This commit is contained in:
parent
dc438c9536
commit
ba17643c79
|
@ -60,6 +60,26 @@ func (a *AppCustomer) AccountList() ([]*CustomerAccount, error) {
|
||||||
return accounts, nil
|
return accounts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AppCustomer) SendCustomerText(toUser, openKfId, content string) error {
|
||||||
|
reqUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/kf/send_msg?access_token=%s", a.GetToken())
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
params["touser"] = toUser
|
||||||
|
params["open_kfid"] = openKfId
|
||||||
|
params["msg_type"] = "text"
|
||||||
|
params["text"] = map[string]interface{}{
|
||||||
|
"content": content,
|
||||||
|
}
|
||||||
|
reqBody, _ := json.Marshal(params)
|
||||||
|
rspBody, err := util.HttpPostJson(reqUrl, nil, reqBody)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = a.GetResult(rspBody)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func (a *AppCustomer) SyncMessage(cursor, token, openKfId string) ([]*CustomerMessage, string, error) {
|
func (a *AppCustomer) SyncMessage(cursor, token, openKfId string) ([]*CustomerMessage, string, error) {
|
||||||
reqUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/kf/sync_msg?access_token=%s", a.GetToken())
|
reqUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/kf/sync_msg?access_token=%s", a.GetToken())
|
||||||
params := make(map[string]interface{})
|
params := make(map[string]interface{})
|
||||||
|
|
Loading…
Reference in New Issue