mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-12 08:42:28 +08:00
feat: 企业微信-客户联系-结束临时会话 (#878)
This commit is contained in:
@@ -17,6 +17,8 @@ const (
|
|||||||
listContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list_contact_way?access_token=%s"
|
listContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/list_contact_way?access_token=%s"
|
||||||
// delContactWayURL 删除企业已配置的「联系我」方式
|
// delContactWayURL 删除企业已配置的「联系我」方式
|
||||||
delContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_contact_way?access_token=%s"
|
delContactWayURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/del_contact_way?access_token=%s"
|
||||||
|
// closeTempChatURL 结束临时会话
|
||||||
|
closeTempChatURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/close_temp_chat?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -267,3 +269,26 @@ func (r *Client) DelContactWay(req *DelContactWayRequest) (*DelContactWayRespons
|
|||||||
err = util.DecodeWithError(response, result, "DelContactWay")
|
err = util.DecodeWithError(response, result, "DelContactWay")
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloseTempChatRequest 结束临时会话请求
|
||||||
|
type CloseTempChatRequest struct {
|
||||||
|
UserID string `json:"userid"`
|
||||||
|
ExternalUserID string `json:"external_userid"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CloseTempChat 结束临时会话
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/92228
|
||||||
|
func (r *Client) CloseTempChat(req *CloseTempChatRequest) error {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(closeTempChatURL, accessToken), req); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return util.DecodeWithCommonError(response, "CloseTempChat")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user