Documentation
¶
Overview ¶
客服主动回复消息.
Index ¶
Constants ¶
View Source
const ( MsgTypeText = "text" // 文本消息 MsgTypeImage = "image" // 图片消息 MsgTypeVoice = "voice" // 语音消息 MsgTypeVideo = "video" // 视频消息 MsgTypeMusic = "music" // 音乐消息 MsgTypeNews = "news" // 图文消息 )
View Source
const (
NewsArticleCountLimit = 10
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Title string `json:"title,omitempty"` // 图文消息标题
Description string `json:"description,omitempty"` // 图文消息描述
URL string `json:"url,omitempty"` // 点击图文消息跳转链接
PicURL string `json:"picurl,omitempty"` // 图文消息的图片链接,支持JPG、PNG格式,较好的效果为大图640*320,小图80*80
}
图文消息里的 Article
type Client ¶
type Client struct {
mp.WechatClient
}
type CommonMessageHeader ¶
type CustomService ¶
type CustomService struct {
KfAccount string `json:"kfaccount"`
}
如果需要以某个客服帐号来发消息(在微信6.0.2及以上版本中显示自定义头像), 则需在JSON数据包的后半部分加入 customservice 参数
type Image ¶
type Image struct {
CommonMessageHeader
Image struct {
MediaId string `json:"media_id"` // 通过上传多媒体文件得到的 MediaId
} `json:"image"`
*CustomService `json:"customservice,omitempty"`
}
图片消息
type Music ¶
type Music struct {
CommonMessageHeader
Music struct {
Title string `json:"title,omitempty"` // 音乐标题
Description string `json:"description,omitempty"` // 音乐描述
MusicURL string `json:"musicurl,omitempty"` // 音乐链接
HQMusicURL string `json:"hqmusicurl,omitempty"` // 高质量音乐链接, WIFI环境优先使用该链接播放音乐
ThumbMediaId string `json:"thumb_media_id,omitempty"` // 缩略图的媒体id, 通过上传多媒体文件得到
} `json:"music"`
*CustomService `json:"customservice,omitempty"`
}
音乐消息
type News ¶
type News struct {
CommonMessageHeader
News struct {
Articles []Article `json:"articles,omitempty"` // 多条图文消息信息, 默认第一个item为大图, 注意, 如果图文数超过10, 则将会无响应
} `json:"news"`
*CustomService `json:"customservice,omitempty"`
}
图文消息
func (*News) CheckValid ¶
检查 News 是否有效,有效返回 nil,否则返回错误信息.
type Text ¶
type Text struct {
CommonMessageHeader
Text struct {
Content string `json:"content"` // 支持换行符
} `json:"text"`
*CustomService `json:"customservice,omitempty"`
}
文本消息
type Video ¶
type Video struct {
CommonMessageHeader
Video struct {
MediaId string `json:"media_id"` // 通过上传多媒体文件得到的 MediaId
ThumbMediaId string `json:"thumb_media_id"` // 缩略图的媒体id, 通过上传多媒体文件得到
Title string `json:"title,omitempty"` // 视频消息的标题
Description string `json:"description,omitempty"` // 视频消息的描述
} `json:"video"`
*CustomService `json:"customservice,omitempty"`
}
视频消息
type Voice ¶
type Voice struct {
CommonMessageHeader
Voice struct {
MediaId string `json:"media_id"` // 通过上传多媒体文件得到的 MediaId
} `json:"voice"`
*CustomService `json:"customservice,omitempty"`
}
语音消息
Click to show internal directories.
Click to hide internal directories.