Documentation
¶
Index ¶
- type AccessTokenSchema
- type AccountAddOptions
- type AccountAddSchema
- type AccountDelOptions
- type AccountInfoSchema
- type AccountListSchema
- type AccountUpdateOptions
- type AddContactWayOptions
- type AddContactWaySchema
- type BaseModel
- type Client
- func (r *Client) AccountAdd(options AccountAddOptions) (info AccountAddSchema, err error)
- func (r *Client) AccountDel(options AccountDelOptions) (info BaseModel, err error)
- func (r *Client) AccountList() (info AccountListSchema, err error)
- func (r *Client) AccountUpdate(options AccountUpdateOptions) (info BaseModel, err error)
- func (r *Client) AddContactWay(options AddContactWayOptions) (info AddContactWaySchema, err error)
- func (r *Client) CustomerBatchGet(options CustomerBatchGetOptions) (info CustomerBatchGetSchema, err error)
- func (r *Client) DecryptMsg(options CryptoOptions, postData []byte) ([]byte, error)
- func (r *Client) GetAccessToken() (info AccessTokenSchema, err error)
- func (r *Client) MediaUpload(options MediaUploadOptions) (info MediaUploadSchema, err error)
- func (r *Client) ReceptionistAdd(options ReceptionistOptions) (info ReceptionistSchema, err error)
- func (r *Client) ReceptionistDel(options ReceptionistOptions) (info ReceptionistSchema, err error)
- func (r *Client) ReceptionistList(kfID string) (info ReceptionistListSchema, err error)
- func (r *Client) SendMsg(options interface{}) (info SendMsgSchema, err error)
- func (r *Client) SyncMsg(options SyncMsgOptions) (info SyncMsgSchema, err error)
- func (r *Client) VerifyURL(options CryptoOptions) (string, error)
- type CryptoOptions
- type CustomerBatchGetOptions
- type CustomerBatchGetSchema
- type CustomerSchema
- type MediaUploadOptions
- type MediaUploadSchema
- type Options
- type ReceptionistListSchema
- type ReceptionistOptions
- type ReceptionistSchema
- type SendMsgSchema
- type SyncMsgOptions
- type SyncMsgSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessTokenSchema ¶
type AccessTokenSchema struct { BaseModel AccessToken string `json:"access_token"` // 获取到的凭证,最长为512字节 ExpiresIn int `json:"expires_in"` // 凭证的有效时间(秒) }
AccessTokenSchema 获取调用凭证响应数据
type AccountAddOptions ¶
type AccountAddOptions struct { Name string `json:"name"` // 客服帐号名称, 不多于16个字符 MediaID string `json:"media_id"` // 客服头像临时素材。可以调用上传临时素材接口获取, 不多于128个字节 }
AccountAddOptions 添加客服账号请求参数
type AccountAddSchema ¶
AccountAddSchema 添加客服账号响应内容
type AccountDelOptions ¶
type AccountDelOptions struct {
OpenKFID string `json:"open_kfid"` // 客服帐号ID, 不多于64字节
}
AccountDelOptions 删除客服账号请求参数
type AccountInfoSchema ¶
type AccountInfoSchema struct { OpenKFID string `json:"open_kfid"` // 客服帐号ID, 不多于64字节 Name string `json:"name"` // 客服帐号名称, 不多于16个字符 MediaID string `json:"media_id"` // 客服头像临时素材。可以调用上传临时素材接口获取, 不多于128个字节 }
AccountInfoSchema 客服详情
type AccountListSchema ¶
type AccountListSchema struct { BaseModel AccountList []AccountInfoSchema `json:"account_list"` // 客服账号列表 }
AccountListSchema 获取客服账号列表响应内容
type AccountUpdateOptions ¶
type AccountUpdateOptions struct { OpenKFID string `json:"open_kfid"` // 客服帐号ID, 不多于64字节 Name string `json:"name"` // 客服帐号名称, 不多于16个字符 MediaID string `json:"media_id"` // 客服头像临时素材。可以调用上传临时素材接口获取, 不多于128个字节 }
AccountUpdateOptions 修改客服账号请求参数
type AddContactWayOptions ¶
type AddContactWayOptions struct { OpenKFID string `json:"open_kfid"` // 客服帐号ID, 不多于64字节 Scene string `json:"scene"` // 场景值,字符串类型,由开发者自定义, 不多于32字节, 字符串取值范围(正则表达式):[0-9a-zA-Z_-]* }
AddContactWayOptions 获取客服账号链接
type AddContactWaySchema ¶
type AddContactWaySchema struct { BaseModel URL string `json:"url"` // 客服链接,开发者可将该链接嵌入到H5页面中,用户点击链接即可向对应的微信客服帐号发起咨询。开发者也可根据该url自行生成需要的二维码图片 }
AddContactWaySchema 获取客服账号链接响应内容
type BaseModel ¶
type BaseModel struct { ErrCode int `json:"errcode"` // 出错返回码,为0表示成功,非0表示调用失败 ErrMsg string `json:"errmsg"` // 返回码提示语 }
BaseModel 基础数据
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 微信客服实例
func (*Client) AccountAdd ¶
func (r *Client) AccountAdd(options AccountAddOptions) (info AccountAddSchema, err error)
AccountAdd 添加客服账号
func (*Client) AccountDel ¶
func (r *Client) AccountDel(options AccountDelOptions) (info BaseModel, err error)
AccountDel 删除客服账号
func (*Client) AccountList ¶
func (r *Client) AccountList() (info AccountListSchema, err error)
AccountList 获取客服账号列表
func (*Client) AccountUpdate ¶
func (r *Client) AccountUpdate(options AccountUpdateOptions) (info BaseModel, err error)
AccountUpdate 修复客服账号
func (*Client) AddContactWay ¶
func (r *Client) AddContactWay(options AddContactWayOptions) (info AddContactWaySchema, err error)
AddContactWay 获取客服账号链接
func (*Client) CustomerBatchGet ¶
func (r *Client) CustomerBatchGet(options CustomerBatchGetOptions) (info CustomerBatchGetSchema, err error)
CustomerBatchGet 客户基本信息获取
func (*Client) DecryptMsg ¶
func (r *Client) DecryptMsg(options CryptoOptions, postData []byte) ([]byte, error)
DecryptMsg 解密消息
func (*Client) GetAccessToken ¶
func (r *Client) GetAccessToken() (info AccessTokenSchema, err error)
GetAccessToken 获取调用凭证access_token
func (*Client) MediaUpload ¶
func (r *Client) MediaUpload(options MediaUploadOptions) (info MediaUploadSchema, err error)
MediaUpload 上传临时素材 上传的媒体文件限制 所有文件size必须大于5个字节 图片(image):2MB,支持JPG,PNG格式 语音(voice) :2MB,播放长度不超过60s,仅支持AMR格式 视频(video) :10MB,支持MP4格式 普通文件(file):20MB
func (*Client) ReceptionistAdd ¶ added in v0.0.4
func (r *Client) ReceptionistAdd(options ReceptionistOptions) (info ReceptionistSchema, err error)
ReceptionistAdd 添加接待人员
func (*Client) ReceptionistDel ¶ added in v0.0.4
func (r *Client) ReceptionistDel(options ReceptionistOptions) (info ReceptionistSchema, err error)
ReceptionistDel 删除接待人员
func (*Client) ReceptionistList ¶ added in v0.0.4
func (r *Client) ReceptionistList(kfID string) (info ReceptionistListSchema, err error)
ReceptionistList 获取接待人员列表
func (*Client) SendMsg ¶
func (r *Client) SendMsg(options interface{}) (info SendMsgSchema, err error)
SendMsg 获取消息
func (*Client) SyncMsg ¶
func (r *Client) SyncMsg(options SyncMsgOptions) (info SyncMsgSchema, err error)
SyncMsg 获取消息
type CryptoOptions ¶
type CryptoOptions struct { Signature string `form:"msg_signature"` TimeStamp string `form:"timestamp"` Nonce string `form:"nonce"` EchoStr string `form:"echostr"` }
CryptoOptions 微信服务器验证参数
type CustomerBatchGetOptions ¶
type CustomerBatchGetOptions struct {
ExternalUserIDList []string `json:"external_userid_list"` // external_userid列表
}
CustomerBatchGetOptions 客户基本信息获取请求参数
type CustomerBatchGetSchema ¶
type CustomerBatchGetSchema struct { BaseModel CustomerList []CustomerSchema `json:"customer_list"` // 微信客户信息列表 InvalidExternalUserID []string `json:"invalid_external_userid"` // 无效的微信客户ID }
CustomerBatchGetSchema 获取客户基本信息响应内容
type CustomerSchema ¶
type CustomerSchema struct { ExternalUserID string `json:"external_userid"` // 微信客户的external_userid NickName string `json:"nickname"` // 微信昵称 Avatar string `json:"avatar"` // 微信头像。第三方不可获取 Gender int `json:"gender"` // 性别 UnionID string `json:"unionid"` // unionid,需要绑定微信开发者帐号才能获取到,查看绑定方法: https://open.work.weixin.qq.com/kf/doc/92512/93143/94769#%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96%E5%BE%AE%E4%BF%A1%E5%AE%A2%E6%88%B7%E7%9A%84unionid }
CustomerSchema 微信客户基本资料
type MediaUploadOptions ¶
type MediaUploadOptions struct { //上传文件类型 Type string `json:"type"` // 媒体文件类型,分别有图片(image)、语音(voice)、视频(video),普通文件(file) //文件名 FileName string `json:"fileName"` // 文件名 //文件大小 FileSize int64 `json:"fileSize"` // 文件大小 //文件内容 File multipart.File // 文件内容 }
MediaUploadOptions 上传临时素材请求参数
type MediaUploadSchema ¶
type MediaUploadSchema struct { BaseModel Type string `json:"type"` // 媒体文件类型,分别有图片(image)、语音(voice)、视频(video),普通文件(file) MediaID string `json:"media_id"` // 媒体文件上传后获取的唯一标识,3天内有效 CreatedAt string `json:"created_at"` // 媒体文件上传时间戳 }
MediaUploadSchema 上传临时素材响应内容
type Options ¶
type Options struct { CorpID string // 企业ID:企业开通的每个微信客服,都对应唯一的企业ID,企业可在微信客服管理后台的企业信息处查看 Secret string // Secret是微信客服用于校验开发者身份的访问密钥,企业成功注册微信客服后,可在「微信客服管理后台-开发配置」处获取 Token string // 用于生成签名校验回调请求的合法性 EncodingAESKey string // 回调消息加解密参数是AES密钥的Base64编码,用于解密回调消息内容对应的密文 Cache cache.Cache // 数据缓存 ExpireTime time.Duration // 令牌过期时间 }
Options 微信客服初始化参数
type ReceptionistListSchema ¶ added in v0.0.4
type ReceptionistListSchema struct { BaseModel ReceptionistList []struct { UserID string `json:"userid"` // 接待人员的userid。第三方应用获取到的为密文userid,即open_userid Status int `json:"status"` // 接待人员的接待状态。0:接待中,1:停止接待。第三方应用需具有“管理帐号、分配会话和收发消息”权限才可获取 } `json:"servicer_list"` }
ReceptionistListSchema 获取接待人员列表响应内容
type ReceptionistOptions ¶ added in v0.0.4
type ReceptionistOptions struct { OpenKFID string `json:"open_kfid"` // 客服帐号ID UserIDList []string `json:"userid_list"` // 接待人员userid列表 }
ReceptionistOptions 添加接待人员请求参数
type ReceptionistSchema ¶ added in v0.0.4
ReceptionistSchema 添加接待人员响应内容
type SendMsgSchema ¶
type SendMsgSchema struct { BaseModel MsgID string `json:"msgid"` // 消息ID。如果请求参数指定了msgid,则原样返回,否则系统自动生成并返回。不多于32字节, 字符串取值范围(正则表达式):[0-9a-zA-Z_-]* }
SendMsgSchema 发送消息响应内容
type SyncMsgOptions ¶
type SyncMsgOptions struct { Cursor string `json:"cursor"` // 上一次调用时返回的next_cursor,第一次拉取可以不填, 不多于64字节 Token string `json:"token"` // 回调事件返回的token字段,10分钟内有效;可不填,如果不填接口有严格的频率限制, 不多于128字节 Limit uint `json:"limit"` // 期望请求的数据量,默认值和最大值都为1000, 注意:可能会出现返回条数少于limit的情况,需结合返回的has_more字段判断是否继续请求。 }
SyncMsgOptions 获取消息查询参数
type SyncMsgSchema ¶
type SyncMsgSchema struct { ErrCode int32 `json:"errcode"` // 返回码 ErrMsg string `json:"errmsg"` // 错误码描述 NextCursor string `json:"next_cursor"` // 下次调用带上该值则从该key值往后拉,用于增量拉取 HasMore uint32 `json:"has_more"` // 是否还有更多数据。0-否;1-是。不能通过判断msg_list是否空来停止拉取,可能会出现has_more为1,而msg_list为空的情况 MsgList [][]byte `json:"msg_list"` // 消息列表 }
SyncMsgSchema 获取消息查询响应内容