Documentation ¶
Index ¶
- Constants
- type CDATA
- type EncryptMessage
- type Message
- type MessageEvent
- type MessageFile
- type MessageImage
- type MessageLink
- type MessageLocation
- type MessageShortVideo
- type MessageText
- type MessageVideo
- type MessageVoice
- type ReplyEncryptMessage
- type ReplyMessage
- type ReplyMessageImage
- type ReplyMessageMusic
- type ReplyMessageNews
- type ReplyMessageText
- type ReplyMessageTransferCustomerService
- type ReplyMessageVideo
- type ReplyMessageVoice
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 EncryptMessage ¶
启用 加密模式 后 收到的 消息格式 <xml>
<ToUserName><![CDATA[]]></ToUserName> <Encrypt><![CDATA[]]></Encrypt>
</xml>
type MessageEvent ¶
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 ¶
<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 ¶
<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 ¶
<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 ¶
<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 ¶
<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 ¶
<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 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>
Click to show internal directories.
Click to hide internal directories.