type_message

package
v1.0.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MsgTypeText       = "text"
	MsgTypeImage      = "image"
	MsgTypeVoice      = "voice"
	MsgTypeVideo      = "video"
	MsgTypeShortVideo = "shortvideo"
	MsgTypeLocation   = "location"
	MsgTypeLink       = "link"
	MsgTypeFile       = "file"
	MsgTypeEvent      = "event"
)
View Source
const (
	ReplyMsgTypeText                    = "text"
	ReplyMsgTypeImage                   = "image"
	ReplyMsgTypeVoice                   = "voice"
	ReplyMsgTypeVideo                   = "video"
	ReplyMsgTypeMusic                   = "music"
	ReplyMsgTypeNews                    = "news"
	ReplyMsgTypeTransferCustomerService = "transfer_customer_service" // 消息转发到(指定)客服
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CDATA

type CDATA string

func (CDATA) MarshalXML

func (c CDATA) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type EncryptMessage

type EncryptMessage struct {
	XMLName    xml.Name `xml:"xml"`
	ToUserName string
	Encrypt    string
}

启用 加密模式 后 收到的 消息格式 <xml>

<ToUserName><![CDATA[]]></ToUserName>
<Encrypt><![CDATA[]]></Encrypt>

</xml>

type Message

type Message struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string
	FromUserName string
	CreateTime   string
	MsgType      string
}

type MessageEvent

type MessageEvent struct {
	Message
	Event string
}

type MessageFile

type MessageFile struct {
	Message
	MsgId        string
	Title        string
	Description  string
	FileKey      string
	FileMd5      string
	FileTotalLen string
}

<xml>

<ToUserName><![CDATA[]]></ToUserName>
<FromUserName><![CDATA[]]></FromUserName>
<CreateTime>1596098918</CreateTime>
<MsgType><![CDATA[file]]></MsgType>
<Title><![CDATA[2020-07-30]]></Title>
<Description><![CDATA[2.5 KB]]></Description>
<FileKey><![CDATA[]]></FileKey>
<FileMd5><![CDATA[]]></FileMd5>
<FileTotalLen>2515</FileTotalLen>
<MsgId>22850641670526495</MsgId>

</xml>

type MessageImage

type MessageImage struct {
	Message
	MsgId   string
	PicUrl  string
	MediaId string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<PicUrl><![CDATA[this is a url]]></PicUrl>
<MediaId><![CDATA[media_id]]></MediaId>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageLink struct {
	Message
	MsgId       string
	Title       string
	Description string
	Url         string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1351776360</CreateTime>
<MsgType><![CDATA[link]]></MsgType>
<Title><![CDATA[公众平台官网链接]]></Title>
<Description><![CDATA[公众平台官网链接]]></Description>
<Url><![CDATA[url]]></Url>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageLocation

type MessageLocation struct {
	Message
	MsgId      string
	Location_X string
	Location_Y string
	Scale      string
	Label      string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1351776360</CreateTime>
<MsgType><![CDATA[location]]></MsgType>
<Location_X>23.134521</Location_X>
<Location_Y>113.358803</Location_Y>
<Scale>20</Scale>
<Label><![CDATA[位置信息]]></Label>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageShortVideo

type MessageShortVideo struct {
	Message
	MsgId        string
	MediaId      string
	ThumbMediaId string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[shortvideo]]></MsgType>
<MediaId><![CDATA[media_id]]></MediaId>
<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageText

type MessageText struct {
	Message
	MsgId   string
	Content string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[this is a test]]></Content>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageVideo

type MessageVideo struct {
	Message
	MsgId        string
	MediaId      string
	ThumbMediaId string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[video]]></MsgType>
<MediaId><![CDATA[media_id]]></MediaId>
<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageVoice

type MessageVoice struct {
	Message
	MsgId       string
	Format      string
	Recognition string
}

<xml>

<ToUserName>< ![CDATA[toUser] ]></ToUserName>
<FromUserName>< ![CDATA[fromUser] ]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType>< ![CDATA[voice] ]></MsgType>
<MediaId>< ![CDATA[media_id] ]></MediaId>
<Format>< ![CDATA[Format] ]></Format>
<Recognition>< ![CDATA[腾讯微信团队] ]></Recognition>
<MsgId>1234567890123456</MsgId>

</xml>

type ReplyEncryptMessage

type ReplyEncryptMessage struct {
	XMLName      xml.Name `xml:"xml"`
	Encrypt      string
	MsgSignature string
	TimeStamp    string
	Nonce        string
}

加密处理后 的 回复 消息体 <xml> <Encrypt></Encrypt> <MsgSignature></MsgSignature> <TimeStamp></TimeStamp> <Nonce></Nonce> </xml>

type ReplyMessage

type ReplyMessage struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   CDATA
	FromUserName CDATA
	CreateTime   string
	MsgType      CDATA
}

type ReplyMessageImage

type ReplyMessageImage struct {
	ReplyMessage
	Image struct {
		MediaId CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<Image>
  <MediaId><![CDATA[media_id]]></MediaId>
</Image>

</xml>

type ReplyMessageMusic

type ReplyMessageMusic struct {
	ReplyMessage
	Music struct {
		MediaId      CDATA
		Title        CDATA
		Description  CDATA
		MusicUrl     CDATA
		HQMusicUrl   CDATA
		ThumbMediaId CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[music]]></MsgType>
<Music>
  <Title><![CDATA[TITLE]]></Title>
  <Description><![CDATA[DESCRIPTION]]></Description>
  <MusicUrl><![CDATA[MUSIC_Url]]></MusicUrl>
  <HQMusicUrl><![CDATA[HQ_MUSIC_Url]]></HQMusicUrl>
  <ThumbMediaId><![CDATA[media_id]]></ThumbMediaId>
</Music>

</xml>

type ReplyMessageNews

type ReplyMessageNews struct {
	ReplyMessage
	ArticleCount string
	Articles     struct {
		Item []struct {
			Title       CDATA
			Description CDATA
			PicUrl      CDATA
			URL         CDATA
		}
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[news]]></MsgType>
<ArticleCount>1</ArticleCount>
<Articles>
  <item>
    <Title><![CDATA[title1]]></Title>
    <Description><![CDATA[description1]]></Description>
    <PicUrl><![CDATA[picurl]]></PicUrl>
    <Url><![CDATA[url]]></Url>
  </item>
</Articles>

</xml>

type ReplyMessageText

type ReplyMessageText struct {
	ReplyMessage
	Content CDATA
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[你好]]></Content>

</xml>

type ReplyMessageTransferCustomerService

type ReplyMessageTransferCustomerService struct {
	ReplyMessage
	TransInfo struct {
		KfAccount CDATA
	}
}

type ReplyMessageVideo

type ReplyMessageVideo struct {
	ReplyMessage
	Video struct {
		MediaId     CDATA
		Title       CDATA
		Description CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[video]]></MsgType>
<Video>
  <MediaId><![CDATA[media_id]]></MediaId>
  <Title><![CDATA[title]]></Title>
  <Description><![CDATA[description]]></Description>
</Video>

</xml>

type ReplyMessageVoice

type ReplyMessageVoice struct {
	ReplyMessage
	Voice struct {
		MediaId CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[voice]]></MsgType>
<Voice>
  <MediaId><![CDATA[media_id]]></MediaId>
</Voice>

</xml>

Jump to

Keyboard shortcuts

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