kf

package
v0.0.0-...-4a54426 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAccount

func AddAccount(account, nickname string) wx.Action

AddAccount 添加客服账号

func CloseSession

func CloseSession(account, openid string) wx.Action

CloseSession 关闭会话

func CreateSession

func CreateSession(account, openid string) wx.Action

CreateSession 创建会话

func DeleteAccount

func DeleteAccount(account string) wx.Action

DeleteAccount 删除客服帐号 完整客服帐号,格式为:帐号前缀@公众号微信号

func GetAccountList

func GetAccountList(result *ResultAccountList) wx.Action

GetAccountList 获取客服列表

func GetMsgRecordList

func GetMsgRecordList(msgID, starttime, endtime int64, number int, result *ResultMsgRecordList) wx.Action

GetMsgRecordList 获取聊天记录(每次查询时段不能超过24小时) 聊天记录中,对于图片、语音、视频,分别展示成文本格式的[image]、[voice]、[video]。

func GetOnlineList

func GetOnlineList(result *ResultOnlineList) wx.Action

GetOnlineList 获取客服在线列表

func GetSession

func GetSession(openid string, result *Session) wx.Action

GetSession 获取客户会话状态 获取一个客户的会话,如果不存在,则kf_account为空。

func GetSessionList

func GetSessionList(account string, result *ResultSessionList) wx.Action

GetSessionList 获取客服会话列表 完整客服帐号,格式为:帐号前缀@公众号微信号

func GetWaitCase

func GetWaitCase(result *WaitCase) wx.Action

GetWaitCase 获取未接入会话列表 最多返回100条数据,按照来访顺序

func InviteWorker

func InviteWorker(account, inviteWX string) wx.Action

InviteWorker 邀请绑定客服帐号 新添加的客服帐号是不能直接使用的,只有客服人员用微信号绑定了客服账号后,方可登录Web客服进行操作。 发起一个绑定邀请到客服人员微信号,客服人员需要在微信客户端上用该微信号确认后帐号才可用。 尚未绑定微信号的帐号可以进行绑定邀请操作,邀请未失效时不能对该帐号进行再次绑定微信号邀请。

func SendImageMsg

func SendImageMsg(openID, mediaID string, kfAccount ...string) wx.Action

SendImageMsg 发送客服图片消息(媒体ID,通过素材接口上传获得)

func SendMPNewsArticleMsg

func SendMPNewsArticleMsg(openID, articleID string, kfAccount ...string) wx.Action

SendMPNewsArticleMsg 发送图文消息(点击跳转到图文消息页面)使用通过 “发布” 系列接口得到的 article_id 注意: 草稿接口灰度完成后,将不再支持此前客服接口中带 media_id 的 mpnews 类型的图文消息

func SendMPNewsMsg

func SendMPNewsMsg(openID, mediaID string, kfAccount ...string) wx.Action

SendMPNewsMsg 发送图文消息(点击跳转到图文消息页面;图文消息条数限制在1条以内,注意,如果图文数超过1,则将会返回错误码45008)

func SendMenuMsg

func SendMenuMsg(openID string, menu *MsgMenu, kfAccount ...string) wx.Action

SendMenuMsg 发送客服菜单消息

func SendMinipPageMsg

func SendMinipPageMsg(openID string, minipPage *MsgMinipPage, kfAccount ...string) wx.Action

SendMinipPageMsg 发送客服小程序卡片消息

func SendMusicMsg

func SendMusicMsg(openID string, music *MsgMusic, kfAccount ...string) wx.Action

SendMusicMsg 发送客服音乐消息

func SendNewsMsg

func SendNewsMsg(openID string, articles []*MsgArticle, kfAccount ...string) wx.Action

SendNewsMsg 发送客服图文消息(点击跳转到外链;图文消息条数限制在1条以内,注意,如果图文数超过1,则将会返回错误码45008)

func SendTextMsg

func SendTextMsg(openID, content string, kfAccount ...string) wx.Action

SendTextMsg 发送客服文本消息(支持插入跳小程序的文字链)

func SendTyping

func SendTyping(openID string, cmd TypeCmd) wx.Action

SendTyping 下发当前输入状态(仅支持客服消息)

func SendVideoMsg

func SendVideoMsg(openID string, video *MsgVideo, kfAccount ...string) wx.Action

SendVideoMsg 发送客服视频消息(媒体ID,通过素材接口上传获得)

func SendVoiceMsg

func SendVoiceMsg(openID, mediaID string, kfAccount ...string) wx.Action

SendVoiceMsg 发送客服语音消息(媒体ID,通过素材接口上传获得)

func SendWXCardMsg

func SendWXCardMsg(openID, cardID string, kfAccount ...string) wx.Action

SendWXCardMsg 发送客服卡券消息(特别注意:客服消息接口投放卡券仅支持非自定义Code码和导入code模式的卡券的卡券)

func UpdateAccount

func UpdateAccount(account, nickname string) wx.Action

UpdateAccount 设置客服信息

func UploadAvatar

func UploadAvatar(account, imgPath string) wx.Action

UploadAvatar 上传客服头像(文件大小为5M以内)

Types

type Account

type Account struct {
	KFID             string       `json:"kf_id"`              // 客服编号
	KFAccount        string       `json:"kf_account"`         // 完整客服帐号,格式为:帐号前缀@公众号微信号
	KFNick           string       `json:"kf_nick"`            // 客服昵称
	KFHeadImgURL     string       `json:"kf_headimgurl"`      // 客服头像
	KFWX             string       `json:"kf_wx"`              // 如果客服帐号已绑定了客服人员微信号, 则此处显示微信号
	InviteWeixin     string       `json:"invite_wx"`          // 如果客服帐号尚未绑定微信号,但是已经发起了一个绑定邀请, 则此处显示绑定邀请的微信号
	InviteExpireTime int64        `json:"invite_expire_time"` // 如果客服帐号尚未绑定微信号,但是已经发起过一个绑定邀请, 邀请的过期时间,为unix 时间戳
	InviteStatus     InviteStatus `json:"invite_status"`      // 邀请的状态,有等待确认“waiting”,被拒绝“rejected”, 过期“expired”
}

Account 客服账号

type InviteStatus

type InviteStatus string

InviteStatus 客服邀请状态

const (
	InviteWaiting  InviteStatus = "waiting"  // 待确认
	InviteRejected InviteStatus = "rejected" // 被拒绝
	InviteExpired  InviteStatus = "expired"  // 已过期
)

微信支持的客服邀请状态

type MenuOption struct {
	ID      string `json:"id"`
	Content string `json:"content"`
}

MenuOption 消息菜单选项

type MsgArticle

type MsgArticle struct {
	Title       string `json:"title"`       // 图文消息的标题
	Description string `json:"description"` // 图文消息的描述
	URL         string `json:"url"`         // 图文消息被点击后跳转的链接
	PicURL      string `json:"picurl"`      // 图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图640*320,小图80*80
}

MsgArticle 消息图文

type MsgCard

type MsgCard struct {
	CardID string `json:"card_id"`
}

MsgCard 消息卡券

type MsgKF

type MsgKF struct {
	KFAccount string `json:"kf_account"`
}

MsgKF 消息客服

type MsgMPNewsArticle

type MsgMPNewsArticle struct {
	ArticleID string `json:"article_id"`
}

MsgMPNewsArticle 消息图文

type MsgMedia

type MsgMedia struct {
	MediaID string `json:"media_id"`
}

MsgMedia 消息媒体(图片等)

type MsgMenu

type MsgMenu struct {
	HeadContent string        `json:"head_content"`
	TailContent string        `json:"tail_content"`
	List        []*MenuOption `json:"list"`
}

MsgMenu 消息菜单

type MsgMinipPage

type MsgMinipPage struct {
	Title        string `json:"title"`          // 消息标题
	AppID        string `json:"appid"`          // 小程序的appid,要求小程序的appid需要与公众号有关联关系
	PagePath     string `json:"pagepath"`       // 小程序的页面路径,跟app.json对齐,支持参数,比如pages/index/index?foo=bar
	ThumbMediaID string `json:"thumb_media_id"` // 小程序卡片图片的媒体ID,小程序卡片图片建议大小为520*416
}

MsgMinipPage 小程序卡片

type MsgMusic

type MsgMusic struct {
	Title        string `json:"title"`          // 音乐消息的标题
	Description  string `json:"description"`    // 音乐消息的描述
	MusicURL     string `json:"musicurl"`       // 音乐链接
	HQMusicURL   string `json:"hqmusicurl"`     // 高品质音乐链接,wifi环境优先使用该链接播放音乐
	ThumbMediaID string `json:"thumb_media_id"` // 缩略图的媒体ID
}

MsgMusic 消息音乐

type MsgNews

type MsgNews struct {
	Articles []*MsgArticle `json:"articles"`
}

MsgNews 消息图文

type MsgRecord

type MsgRecord struct {
	Worker   string `json:"worker"`   // 完整客服帐号,格式为:帐号前缀@公众号微信号
	OpenID   string `json:"openid"`   // 用户标识
	OperCode int    `json:"opercode"` // 操作码(2002-客服发送信息,2003-客服接收消息)
	Text     string `json:"text"`     // 聊天记录
	Time     int64  `json:"time"`     // 操作时间,unix时间戳
}

MsgRecord 客服聊天记录

type MsgText

type MsgText struct {
	Content string `json:"content"`
}

MsgText 消息文本

type MsgVideo

type MsgVideo struct {
	MediaID      string `json:"media_id"`       // 视频消息(点击跳转到图文消息页)的媒体ID
	ThumbMediaID string `json:"thumb_media_id"` // 缩略图的媒体ID
	Title        string `json:"title"`          // 视频消息的标题
	Description  string `json:"description"`    // 视频消息的描述
}

MsgVideo 消息视频

type Online

type Online struct {
	KFID         string `json:"kf_id"`         // 客服编号
	KFAccount    string `json:"kf_account"`    // 完整客服帐号,格式为:帐号前缀@公众号微信号
	Status       int    `json:"status"`        // 客服在线状态,目前为:1-web在线
	AcceptedCase int    `json:"accepted_case"` // 客服当前正在接待的会话数
}

Online 在线客服

type ParamsAccountAdd

type ParamsAccountAdd struct {
	KFAccount string `json:"kf_account"` // 完整客服帐号,格式为:帐号前缀@公众号微信号,帐号前缀最多10个字符,必须是英文、数字字符或者下划线,后缀为公众号微信号,长度不超过30个字符
	Nickname  string `json:"nickname"`   // 客服昵称,最长16个字
}

type ParamsAccountUpdate

type ParamsAccountUpdate struct {
	KFAccount string `json:"kf_account"` // 完整客服帐号,格式为:帐号前缀@公众号微信号,帐号前缀最多10个字符,必须是英文、数字字符或者下划线,后缀为公众号微信号,长度不超过30个字符
	Nickname  string `json:"nickname"`   // 客服昵称,最长16个字
}

type ParamsMessage

type ParamsMessage struct {
	ToUser        string            `json:"touser"`
	MsgType       event.MsgType     `json:"msgtype"`
	Text          *MsgText          `json:"text,omitempty"`
	Image         *MsgMedia         `json:"image,omitempty"`
	Voice         *MsgMedia         `json:"voice,omitempty"`
	Video         *MsgVideo         `json:"video,omitempty"`
	Music         *MsgMusic         `json:"music,omitempty"`
	News          *MsgNews          `json:"news,omitempty"`
	MPNews        *MsgMedia         `json:"mpnews,omitempty"`
	MPNewsArticle *MsgMPNewsArticle `json:"mpnewsarticle,omitempty"`
	Menu          *MsgMenu          `json:"msgmenu,omitempty"`
	Card          *MsgCard          `json:"wxcard,omitempty"`
	MinipPage     *MsgMinipPage     `json:"miniprogrampage,omitempty"`
	CustomService *MsgKF            `json:"customservice,omitempty"`
}

ParamsMessage 客服消息参数

type ParamsMsgRecordList

type ParamsMsgRecordList struct {
	MsgID     int64 `json:"msgid"`
	StartTime int64 `json:"starttime"`
	EndTime   int64 `json:"endtime"`
	Number    int   `json:"number"`
}

type ParamsSessionClose

type ParamsSessionClose struct {
	KFAccount string `json:"kf_account"` // 完整客服帐号,格式为:帐号前缀@公众号微信号
	OpenID    string `json:"openid"`     // 粉丝的openid
}

type ParamsSessionCreate

type ParamsSessionCreate struct {
	KFAccount string `json:"kf_account"` // 完整客服帐号,格式为:帐号前缀@公众号微信号
	OpenID    string `json:"openid"`     // 粉丝的openid
}

type ParamsTyping

type ParamsTyping struct {
	ToUser  string  `json:"touser"`
	Command TypeCmd `json:"command"`
}

type ParamsWorkerInvite

type ParamsWorkerInvite struct {
	KFAccount string `json:"kf_account"` // 完整客服帐号,格式为:帐号前缀@公众号微信号
	InviteWX  string `json:"invite_wx"`  // 接收绑定邀请的客服微信号
}

type ResultAccountList

type ResultAccountList struct {
	KFList []*Account `json:"kf_list"`
}

type ResultMsgRecordList

type ResultMsgRecordList struct {
	MsgID      int64        `json:"msgid"`
	Number     int          `json:"number"`
	RecordList []*MsgRecord `json:"recordlist"`
}

type ResultOnlineList

type ResultOnlineList struct {
	KFOnlineList []*Online `json:"kf_online_list"`
}

type ResultSessionList

type ResultSessionList struct {
	SessionList []*Session `json:"sessionlist"`
}

type Session

type Session struct {
	KFAccount  string `json:"kf_account"`  // 正在接待的客服,为空表示没有人在接待
	OpenID     string `json:"openid"`      // 粉丝的openid
	CreateTime int64  `json:"createtime"`  // 会话接入的时间
	LatestTime int64  `json:"latest_time"` // 粉丝的最后一条消息的时间
}

Session 客服会话

type TypeCmd

type TypeCmd string

TypeCmd 输入状态命令

const (
	Typing       TypeCmd = "Typing"       // 正在输入
	CancelTyping TypeCmd = "CancelTyping" // 取消输入
)

微信支持的输入状态命令

type WaitCase

type WaitCase struct {
	Count int        `json:"count"`
	List  []*Session `json:"waitcaselist"`
}

WaitCase 客服未接入会话

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL