message

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

View Source
const (
	//MsgTypeText 文本消息
	MsgTypeText MsgType = "text"
	//MsgTypeImage 图片消息
	MsgTypeImage = "image"
	//MsgTypeLink 图文链接
	MsgTypeLink = "link"
	//MsgTypeMiniProgramPage 小程序卡片
	MsgTypeMiniProgramPage = "miniprogrampage"
)

Variables

This section is empty.

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 EventType

type EventType string

EventType 事件类型

type InfoType

type InfoType string

InfoType 第三方平台授权事件类型

type Manager

type Manager struct {
	*context.Context
}

Manager 消息管理者,可以发送消息

func NewCustomerMessageManager

func NewCustomerMessageManager(context *context.Context) *Manager

NewCustomerMessageManager 实例化消息管理者

func (*Manager) Send

func (manager *Manager) Send(msg *CustomerMessage) error

Send 发送客服消息

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 MediaText

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

MediaText 文本消息的文字

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       string `xml:"Event"`
	SessionFrom string `xml:"SessionFrom"`
}

MiniProgramMixMessage 小程序回调的消息结构

type MsgType

type MsgType string

MsgType 基本消息类型

Jump to

Keyboard shortcuts

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