Documentation
¶
Overview ¶
客服消息.
Index ¶
Constants ¶
View Source
const ( MsgTypeText core.MsgType = "text" // 文本消息 MsgTypeImage core.MsgType = "image" // 图片消息 MsgTypeVoice core.MsgType = "voice" // 语音消息 MsgTypeVideo core.MsgType = "video" // 视频消息 MsgTypeMusic core.MsgType = "music" // 音乐消息 MsgTypeNews core.MsgType = "news" // 图文消息 MsgTypeMPNews core.MsgType = "mpnews" // 图文消息, 发送已经创建好的图文 MsgTypeWxCard core.MsgType = "wxcard" // 卡卷消息 MsgTypeWxMiniLink core.MsgType = "link" // 小程序客服消息:图文链接 MsgTypeWxMiniPage core.MsgType = "miniprogrampage" // 小程序卡片消息 MsgTypeMenu core.MsgType = "msgmenu" // 小程序客服消息:菜单 )
Variables ¶
This section is empty.
Functions ¶
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 CustomService ¶
type CustomService struct {
KfAccount string `json:"kf_account"`
}
type Image ¶
type Image struct {
MsgHeader
Image struct {
MediaId string `json:"media_id"` // 通过素材管理接口上传多媒体文件得到 MediaId
} `json:"image"`
CustomService *CustomService `json:"customservice,omitempty"`
}
图片消息
type MPNews ¶
type MPNews struct {
MsgHeader
MPNews struct {
MediaId string `json:"media_id"` // 通过素材管理接口上传多媒体文件得到 MediaId
} `json:"mpnews"`
CustomService *CustomService `json:"customservice,omitempty"`
}
type Music ¶
type Music struct {
MsgHeader
Music struct {
Title string `json:"title,omitempty"` // 音乐标题, 可以为 ""
Description string `json:"description,omitempty"` // 音乐描述, 可以为 ""
MusicURL string `json:"musicurl"` // 音乐链接
HQMusicURL string `json:"hqmusicurl"` // 高质量音乐链接, WIFI环境优先使用该链接播放音乐
ThumbMediaId string `json:"thumb_media_id"` // 通过素材管理接口上传多媒体文件得到 ThumbMediaId
} `json:"music"`
CustomService *CustomService `json:"customservice,omitempty"`
}
音乐消息
type News ¶
type News struct {
MsgHeader
News struct {
Articles []Article `json:"articles,omitempty"` // 多条图文消息信息, 默认第一个item为大图, 注意, 如果图文数超过8, 则将会无响应
} `json:"news"`
CustomService *CustomService `json:"customservice,omitempty"`
}
图文消息
type Text ¶
type Text struct {
MsgHeader
Text struct {
Content string `json:"content"` // 支持换行符
} `json:"text"`
CustomService *CustomService `json:"customservice,omitempty"`
}
文本消息
type Video ¶
type Video struct {
MsgHeader
Video struct {
MediaId string `json:"media_id"` // 通过素材管理接口上传多媒体文件得到 MediaId
ThumbMediaId string `json:"thumb_media_id"` // 通过素材管理接口上传多媒体文件得到 ThumbMediaId
Title string `json:"title,omitempty"` // 视频消息的标题, 可以为 ""
Description string `json:"description,omitempty"` // 视频消息的描述, 可以为 ""
} `json:"video"`
CustomService *CustomService `json:"customservice,omitempty"`
}
视频消息
type Voice ¶
type Voice struct {
MsgHeader
Voice struct {
MediaId string `json:"media_id"` // 通过素材管理接口上传多媒体文件得到 MediaId
} `json:"voice"`
CustomService *CustomService `json:"customservice,omitempty"`
}
语音消息
type WxCard ¶
type WxCard struct {
MsgHeader
WxCard struct {
CardId string `json:"card_id"`
CardExt string `json:"card_ext,omitempty"`
} `json:"wxcard"`
CustomService *CustomService `json:"customservice,omitempty"`
}
卡券消息, 特别注意客服消息接口投放卡券仅支持非自定义Code码的卡券
type WxMiniLink ¶
type WxMiniLink struct {
MsgHeader
Link struct {
Title string `json:"title"`
Description string `json:"description"`
URL string `json:"url"`
ThumbURL string `json:"thumb_url"`
} `json:"link"`
CustomService *CustomService `json:"customservice,omitempty"`
}
func NewMiniLink ¶
func NewMiniLink(toUser, title, desc, url, thumbUrl, kfAccount string) (link *WxMiniLink)
type WxMiniPage ¶
type WxMiniPage struct {
MsgHeader
MiniProgramPage struct {
Title string `json:"title"`
AppId string `json:"appid"`
PagePath string `json:"pagepath"`
ThumbMediaId string `json:"thumb_media_id"`
} `json:"miniprogrampage"`
CustomService *CustomService `json:"customservice,omitempty"`
}
func NewMiniPage ¶
func NewMiniPage(toUser, appId, title, pagePath, thumbMediaId, kfAccount string) (page *WxMiniPage)
Click to show internal directories.
Click to hide internal directories.