Documentation
¶
Index ¶
- Constants
- Variables
- type CommonToken
- type CustomerMessage
- func NewCustomerImgMessage(toUser, mediaID string) *CustomerMessage
- func NewCustomerLinkMessage(toUser, title, description, url, thumbURL string) *CustomerMessage
- func NewCustomerMiniprogrampageMessage(toUser, title, pagepath, thumbMediaID string) *CustomerMessage
- func NewCustomerTextMessage(toUser, text string) *CustomerMessage
- type EncryptedMsg
- type EventType
- type InfoType
- type Manager
- type MediaLink
- type MediaMiniprogrampage
- type MediaResource
- type MediaText
- type MiniProgramMixMessage
- type MsgType
- type Reply
- type SubscribeMessageList
Constants ¶
View Source
const ( // MsgTypeText 文本消息 MsgTypeText MsgType = "text" // MsgTypeImage 图片消息 MsgTypeImage = "image" // MsgTypeLink 图文链接 MsgTypeLink = "link" // MsgTypeMiniProgramPage 小程序卡片 MsgTypeMiniProgramPage = "miniprogrampage" // MsgTypeEvent 表示事件推送消息 MsgTypeEvent = "event" )
Variables ¶
View Source
var ErrInvalidReply = errors.New("无效的回复信息")
ErrInvalidReply 无效的回复
View Source
var ErrUnsupportedReply = errors.New("不支持的回复消息")
ErrUnsupportedReply 不支持的回复类型
Functions ¶
This section is empty.
Types ¶
type CommonToken ¶
type CommonToken struct {
XMLName xml.Name `xml:"xml"`
ToUserName string `xml:"ToUserName"`
FromUserName string `xml:"FromUserName"`
CreateTime int64 `xml:"CreateTime"`
MsgType MsgType `xml:"MsgType"`
}
CommonToken 消息中通用的结构
type CustomerMessage ¶
type CustomerMessage struct {
ToUser string `json:"touser"` // 接受者OpenID
Msgtype MsgType `json:"msgtype"` // 客服消息类型
Text *MediaText `json:"text,omitempty"` // 可选
Image *MediaResource `json:"image,omitempty"` // 可选
Link *MediaLink `json:"link,omitempty"` // 可选
Miniprogrampage *MediaMiniprogrampage `json:"miniprogrampage,omitempty"` // 可选
}
CustomerMessage 客服消息
func NewCustomerImgMessage ¶
func NewCustomerImgMessage(toUser, mediaID string) *CustomerMessage
NewCustomerImgMessage 图片消息的构造方法
func NewCustomerLinkMessage ¶
func NewCustomerLinkMessage(toUser, title, description, url, thumbURL string) *CustomerMessage
NewCustomerLinkMessage 图文链接消息的构造方法
func NewCustomerMiniprogrampageMessage ¶
func NewCustomerMiniprogrampageMessage(toUser, title, pagepath, thumbMediaID string) *CustomerMessage
NewCustomerMiniprogrampageMessage 小程序卡片消息的构造方法
func NewCustomerTextMessage ¶
func NewCustomerTextMessage(toUser, text string) *CustomerMessage
NewCustomerTextMessage 文本消息结构体构造方法
type EncryptedMsg ¶ added in v2.1.2
type EncryptedMsg struct {
XMLName struct{} `xml:"xml" json:"-"`
ToUserName string `xml:"ToUserName" json:"toUserName"`
EncryptedMsg string `xml:"Encrypt" json:"Encrypt"`
}
EncryptedMsg 安全模式下的消息体
type EventType ¶
type EventType string
EventType 事件类型
const ( // EventSubscribePopup 用户操作订阅通知弹窗事件推送,用户在图文等场景内订阅通知的操作 EventSubscribePopup EventType = "subscribe_msg_popup_event" // EventSubscribeChange 用户管理订阅通知,用户在服务通知管理页面做通知管理时的操作 EventSubscribeChange EventType = "subscribe_msg_change_event" // EventSubscribeSent 发送订阅通知,调用 bizsend 接口发送通知 EventSubscribeSent EventType = "subscribe_msg_sent_event" )
type InfoType ¶
type InfoType string
InfoType 第三方平台授权事件类型
const ( InfoTypeAcceptSubscribeMessage InfoType = "accept" InfoTypeRejectSubscribeMessage = "reject" )
type Manager ¶
Manager 消息管理者,可以发送消息
func NewCustomerMessageManager ¶
NewCustomerMessageManager 实例化消息管理者
type MediaLink ¶
type MediaLink struct {
Title string `json:"title"`
Description string `json:"description"`
URL string `json:"url"`
ThumbURL string `json:"thumb_url"`
}
MediaLink 发送图文链接
type MediaMiniprogrampage ¶
type MediaMiniprogrampage struct {
Title string `json:"title"`
Appid string `json:"appid"`
Pagepath string `json:"pagepath"`
ThumbMediaID string `json:"thumb_media_id"`
}
MediaMiniprogrampage 小程序卡片
type MediaResource ¶
type MediaResource struct {
MediaID string `json:"media_id"`
}
MediaResource 消息使用的临时素材id
type MiniProgramMixMessage ¶
type MiniProgramMixMessage struct {
CommonToken
MsgID int64 `xml:"MsgId"`
// 文本消息
Content string `xml:"Content"`
// 图片消息
PicURL string `xml:"PicUrl"`
MediaID string `xml:"MediaId"`
// 小程序卡片消息
Title string `xml:"Title"`
AppID string `xml:"AppId"`
PagePath string `xml:"PagePath"`
ThumbURL string `xml:"ThumbUrl"`
ThumbMediaID string `xml:"ThumbMediaId"`
// 进入会话事件
Event EventType `xml:"Event"`
SessionFrom string `xml:"SessionFrom"`
// 用户操作订阅通知弹窗消息回调
List []SubscribeMessageList `xml:"-" json:"List"`
}
MiniProgramMixMessage 小程序回调的消息结构
type SubscribeMessageList ¶ added in v2.1.1
Click to show internal directories.
Click to hide internal directories.