Documentation ¶
Overview ¶
Package customservice 客服消息/功能
Index ¶
- func GetKfList(ctx *offiaccount.OffiAccount) (resp []byte, err error)
- func GetMsgList(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func GetOnlineKfList(ctx *offiaccount.OffiAccount) (resp []byte, err error)
- func InviteWorker(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func KfSessionCreate(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func KfSessionGet(ctx *offiaccount.OffiAccount, params url.Values) (resp []byte, err error)
- func KfSessionGetList(ctx *offiaccount.OffiAccount, params url.Values) (resp []byte, err error)
- func KfSessionGetWaitCase(ctx *offiaccount.OffiAccount) (resp []byte, err error)
- func KfaccountAdd(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func KfaccountDel(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func KfaccountUpdate(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func SendMessage(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func Typing(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
- func UploadHeadImg(ctx *offiaccount.OffiAccount, media string, params url.Values) (resp []byte, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKfList ¶
func GetKfList(ctx *offiaccount.OffiAccount) (resp []byte, err error)
获取所有客服账号
开发者通过本接口,获取公众号中所设置的客服基本信息,包括客服工号、客服昵称、客服登录账号
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
GET https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount resp, err := customservice.GetKfList(ctx) fmt.Println(resp, err) }
Output:
func GetMsgList ¶
func GetMsgList(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
获取聊天记录
此接口返回的聊天记录中,对于图片、语音、视频,分别展示成文本格式的[image]、[voice]、[video]
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Obtain_chat_transcript.html
POST https://api.weixin.qq.com/customservice/msgrecord/getmsglist
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.GetMsgList(ctx, payload) fmt.Println(resp, err) }
Output:
func GetOnlineKfList ¶
func GetOnlineKfList(ctx *offiaccount.OffiAccount) (resp []byte, err error)
获取客服基本信息
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html
GET https://api.weixin.qq.com/cgi-bin/customservice/getonlinekflist?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount resp, err := customservice.GetOnlineKfList(ctx) fmt.Println(resp, err) }
Output:
func InviteWorker ¶
func InviteWorker(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
邀请绑定客服帐号
新添加的客服帐号是不能直接使用的,只有客服人员用微信号绑定了客服账号后,方可登录Web客服进行操作。此接口发起一个绑定邀请到客服人员微信号,客服人员需要在微信客户端上用该微信号确认后帐号才可用。尚未绑定微信号的帐号可以进行绑定邀请操作,邀请未失效时不能对该帐号进行再次绑定微信号邀请
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Customer_Service_Management.html
POST https://api.weixin.qq.com/customservice/kfaccount/inviteworker?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.InviteWorker(ctx, payload) fmt.Println(resp, err) }
Output:
func KfSessionCreate ¶
func KfSessionCreate(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
创建会话
此接口在客服和用户之间创建一个会话,如果该客服和用户会话已存在,则直接返回0。指定的客服帐号必须已经绑定微信号且在线
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Session_control.html
POST https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.KfSessionCreate(ctx, payload) fmt.Println(resp, err) }
Output:
func KfSessionGet ¶
func KfSessionGet(ctx *offiaccount.OffiAccount, params url.Values) (resp []byte, err error)
获取客户会话状态
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Session_control.html
GET https://api.weixin.qq.com/customservice/kfsession/getsession?access_token=ACCESS_TOKEN&openid=OPENID
Example ¶
package main import ( "fmt" "net/url" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount params := url.Values{} resp, err := customservice.KfSessionGet(ctx, params) fmt.Println(resp, err) }
Output:
func KfSessionGetList ¶
func KfSessionGetList(ctx *offiaccount.OffiAccount, params url.Values) (resp []byte, err error)
获取客服会话列表
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Session_control.html
Example ¶
package main import ( "fmt" "net/url" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount params := url.Values{} resp, err := customservice.KfSessionGetList(ctx, params) fmt.Println(resp, err) }
Output:
func KfSessionGetWaitCase ¶
func KfSessionGetWaitCase(ctx *offiaccount.OffiAccount) (resp []byte, err error)
获取未接入会话列表
See: https://developers.weixin.qq.com/doc/offiaccount/Customer_Service/Session_control.html
GET https://api.weixin.qq.com/customservice/kfsession/getwaitcase?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount resp, err := customservice.KfSessionGetWaitCase(ctx) fmt.Println(resp, err) }
Output:
func KfaccountAdd ¶
func KfaccountAdd(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
添加客服帐号
开发者可以通过本接口为公众号添加客服账号,每个公众号最多添加100个客服账号
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
POST https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.KfaccountAdd(ctx, payload) fmt.Println(resp, err) }
Output:
func KfaccountDel ¶
func KfaccountDel(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
删除客服帐号
开发者可以通过该接口为公众号删除客服帐号
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
POST https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.KfaccountDel(ctx, payload) fmt.Println(resp, err) }
Output:
func KfaccountUpdate ¶
func KfaccountUpdate(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
修改客服帐号
开发者可以通过本接口为公众号修改客服账号
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
POST https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.KfaccountUpdate(ctx, payload) fmt.Println(resp, err) }
Output:
func SendMessage ¶
func SendMessage(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
发消息
发送文本/图片/语言/语音/视频/音乐/图文/菜单/卡券... 消息
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
POST https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.SendMessage(ctx, payload) fmt.Println(resp, err) }
Output:
func Typing ¶
func Typing(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)
客服输入状态
开发者可通过调用“客服输入状态”接口,返回客服当前输入状态给用户
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
POST https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN
Example ¶
package main import ( "fmt" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount payload := []byte("{}") resp, err := customservice.Typing(ctx, payload) fmt.Println(resp, err) }
Output:
func UploadHeadImg ¶
func UploadHeadImg(ctx *offiaccount.OffiAccount, media string, params url.Values) (resp []byte, err error)
设置客服帐号的头像
开发者可调用本接口来上传图片作为客服人员的头像,头像图片文件必须是jpg格式,推荐使用640*640大小的图片以达到最佳效果
See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Service_Center_messages.html
POST(@media) https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT
Example ¶
package main import ( "fmt" "net/url" "github.com/fastwego/offiaccount" "github.com/fastwego/offiaccount/apis/customservice" ) func main() { var ctx *offiaccount.OffiAccount media := "" params := url.Values{} resp, err := customservice.UploadHeadImg(ctx, media, params) fmt.Println(resp, err) }
Output:
Types ¶
This section is empty.