mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-09 23:22:27 +08:00
feat: 企业微信-微信客服,客服账号列表接口支持分页拉取,接待人员增加部门ID
This commit is contained in:
@@ -33,6 +33,7 @@ type AccountAddSchema struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AccountAdd 添加客服账号
|
// AccountAdd 添加客服账号
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94662
|
||||||
func (r *Client) AccountAdd(options AccountAddOptions) (info AccountAddSchema, err error) {
|
func (r *Client) AccountAdd(options AccountAddOptions) (info AccountAddSchema, err error) {
|
||||||
var (
|
var (
|
||||||
accessToken string
|
accessToken string
|
||||||
@@ -59,6 +60,7 @@ type AccountDelOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AccountDel 删除客服账号
|
// AccountDel 删除客服账号
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94663
|
||||||
func (r *Client) AccountDel(options AccountDelOptions) (info util.CommonError, err error) {
|
func (r *Client) AccountDel(options AccountDelOptions) (info util.CommonError, err error) {
|
||||||
var (
|
var (
|
||||||
accessToken string
|
accessToken string
|
||||||
@@ -86,7 +88,8 @@ type AccountUpdateOptions struct {
|
|||||||
MediaID string `json:"media_id"` // 客服头像临时素材。可以调用上传临时素材接口获取, 不多于128个字节
|
MediaID string `json:"media_id"` // 客服头像临时素材。可以调用上传临时素材接口获取, 不多于128个字节
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccountUpdate 修复客服账号
|
// AccountUpdate 修改客服账号
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94664
|
||||||
func (r *Client) AccountUpdate(options AccountUpdateOptions) (info util.CommonError, err error) {
|
func (r *Client) AccountUpdate(options AccountUpdateOptions) (info util.CommonError, err error) {
|
||||||
var (
|
var (
|
||||||
accessToken string
|
accessToken string
|
||||||
@@ -109,9 +112,10 @@ func (r *Client) AccountUpdate(options AccountUpdateOptions) (info util.CommonEr
|
|||||||
|
|
||||||
// AccountInfoSchema 客服详情
|
// AccountInfoSchema 客服详情
|
||||||
type AccountInfoSchema struct {
|
type AccountInfoSchema struct {
|
||||||
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
||||||
Name string `json:"name"` // 客服帐号名称
|
Name string `json:"name"` // 客服帐号名称
|
||||||
Avatar string `json:"avatar"` // 客服头像URL
|
Avatar string `json:"avatar"` // 客服头像URL
|
||||||
|
ManagePrivilege bool `json:"manage_privilege"` // 当前调用接口的应用身份,是否有该客服账号的管理权限(编辑客服账号信息、分配会话和收发消息)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccountListSchema 获取客服账号列表响应内容
|
// AccountListSchema 获取客服账号列表响应内容
|
||||||
@@ -141,6 +145,31 @@ func (r *Client) AccountList() (info AccountListSchema, err error) {
|
|||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AccountPagingRequest 分页获取客服账号列表请求
|
||||||
|
type AccountPagingRequest struct {
|
||||||
|
Offset int `json:"offset"`
|
||||||
|
Limit int `json:"limit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// AccountPaging 分页获取客服账号列表
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94661
|
||||||
|
func (r *Client) AccountPaging(req *AccountPagingRequest) (*AccountListSchema, error) {
|
||||||
|
var (
|
||||||
|
accessToken string
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if accessToken, err = r.ctx.GetAccessToken(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var response []byte
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(accountListAddr, accessToken), req); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
result := &AccountListSchema{}
|
||||||
|
err = util.DecodeWithError(response, result, "AccountPaging")
|
||||||
|
return result, err
|
||||||
|
}
|
||||||
|
|
||||||
// AddContactWayOptions 获取客服账号链接
|
// AddContactWayOptions 获取客服账号链接
|
||||||
// 1.若scene非空,返回的客服链接开发者可拼接scene_param=SCENE_PARAM参数使用,用户进入会话事件会将SCENE_PARAM原样返回。其中SCENE_PARAM需要urlencode,且长度不能超过128字节。
|
// 1.若scene非空,返回的客服链接开发者可拼接scene_param=SCENE_PARAM参数使用,用户进入会话事件会将SCENE_PARAM原样返回。其中SCENE_PARAM需要urlencode,且长度不能超过128字节。
|
||||||
// 如 https://work.weixin.qq.com/kf/kfcbf8f8d07ac7215f?enc_scene=ENCGFSDF567DF&scene_param=a%3D1%26b%3D2
|
// 如 https://work.weixin.qq.com/kf/kfcbf8f8d07ac7215f?enc_scene=ENCGFSDF567DF&scene_param=a%3D1%26b%3D2
|
||||||
@@ -158,6 +187,7 @@ type AddContactWaySchema struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddContactWay 获取客服账号链接
|
// AddContactWay 获取客服账号链接
|
||||||
|
// see https://developer.work.weixin.qq.com/document/path/94665
|
||||||
func (r *Client) AddContactWay(options AddContactWayOptions) (info AddContactWaySchema, err error) {
|
func (r *Client) AddContactWay(options AddContactWayOptions) (info AddContactWaySchema, err error) {
|
||||||
var (
|
var (
|
||||||
accessToken string
|
accessToken string
|
||||||
|
|||||||
@@ -18,15 +18,17 @@ const (
|
|||||||
|
|
||||||
// ReceptionistOptions 添加接待人员请求参数
|
// ReceptionistOptions 添加接待人员请求参数
|
||||||
type ReceptionistOptions struct {
|
type ReceptionistOptions struct {
|
||||||
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
OpenKFID string `json:"open_kfid"` // 客服帐号ID
|
||||||
UserIDList []string `json:"userid_list"` // 接待人员userid列表。第三方应用填密文userid,即open_userid 可填充个数:1 ~ 100。超过100个需分批调用。
|
UserIDList []string `json:"userid_list"` // 接待人员userid列表。第三方应用填密文userid,即open_userid 可填充个数:1 ~ 100。超过100个需分批调用。
|
||||||
|
DepartmentIDList []int `json:"department_id_list"` // 接待人员部门id列表 可填充个数:0 ~ 100。超过100个需分批调用。
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReceptionistSchema 添加接待人员响应内容
|
// ReceptionistSchema 添加接待人员响应内容
|
||||||
type ReceptionistSchema struct {
|
type ReceptionistSchema struct {
|
||||||
util.CommonError
|
util.CommonError
|
||||||
ResultList []struct {
|
ResultList []struct {
|
||||||
UserID string `json:"userid"`
|
UserID string `json:"userid"`
|
||||||
|
DepartmentID int `json:"department_id"`
|
||||||
util.CommonError
|
util.CommonError
|
||||||
} `json:"result_list"`
|
} `json:"result_list"`
|
||||||
}
|
}
|
||||||
@@ -79,8 +81,9 @@ func (r *Client) ReceptionistDel(options ReceptionistOptions) (info Receptionist
|
|||||||
type ReceptionistListSchema struct {
|
type ReceptionistListSchema struct {
|
||||||
util.CommonError
|
util.CommonError
|
||||||
ReceptionistList []struct {
|
ReceptionistList []struct {
|
||||||
UserID string `json:"userid"` // 接待人员的userid。第三方应用获取到的为密文userid,即open_userid
|
UserID string `json:"userid"` // 接待人员的userid。第三方应用获取到的为密文userid,即open_userid
|
||||||
Status int `json:"status"` // 接待人员的接待状态。0:接待中,1:停止接待。第三方应用需具有“管理帐号、分配会话和收发消息”权限才可获取
|
Status int `json:"status"` // 接待人员的接待状态。0:接待中,1:停止接待。第三方应用需具有“管理帐号、分配会话和收发消息”权限才可获取
|
||||||
|
DepartmentID int `json:"department_id"` // 接待人员部门的id
|
||||||
} `json:"servicer_list"`
|
} `json:"servicer_list"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user