Documentation ¶
Index ¶
- Constants
- Variables
- type AESKey
- type Agent
- type AgentSession
- type AgentSessionChange
- type Article
- type Beacon
- type Button
- func NewButtonForClick(name, key string) *Button
- func NewButtonForLocationSelect(name, key string) *Button
- func NewButtonForMediaId(name, mediaID string) *Button
- func NewButtonForMiniprogram(name, url, appID, pagePath string) *Button
- func NewButtonForPicPhotoOrAlbum(name, key string) *Button
- func NewButtonForPicSysPhoto(name, key string) *Button
- func NewButtonForPicWeixin(name, key string) *Button
- func NewButtonForScanCodePush(name, key string) *Button
- func NewButtonForScanCodeWaitMsg(name, key string) *Button
- func NewButtonForView(name, url string) *Button
- func NewButtonForViewLimited(name, mediaID string) *Button
- func NewButtonWithSubButtons(name string, subButtons []*Button) *Button
- type Card
- type Client
- func (c *Client) ChangeGroupForUser(openId string, groupId int) error
- func (c *Client) ChangeGroupForUsers(openIds []string, groupId int) error
- func (c *Client) CloseAgentSession(account, openId, text string) (err error)
- func (c *Client) CorpSendCardByParties(card TextCard, partyIDs []string) error
- func (c *Client) CorpSendCardByTags(card TextCard, tagIDs []string) error
- func (c *Client) CorpSendCardByUsers(card TextCard, userIDs []string) error
- func (c *Client) CorpSendCardToAll(card TextCard) error
- func (c *Client) CorpSendFileByParties(mediaID string, partyIDs []string) error
- func (c *Client) CorpSendFileByTags(mediaID string, tagIDs []string) error
- func (c *Client) CorpSendFileByUsers(mediaID string, userIDs []string) error
- func (c *Client) CorpSendFileToAll(mediaID string) error
- func (c *Client) CorpSendImageByParties(mediaID string, partyIDs []string) error
- func (c *Client) CorpSendImageByTags(mediaID string, tagIDs []string) error
- func (c *Client) CorpSendImageByUsers(mediaID string, userIDs []string) error
- func (c *Client) CorpSendImageToAll(mediaID string) error
- func (c *Client) CorpSendMPNewsByParties(news CorpMPNews, partyIDs []string) error
- func (c *Client) CorpSendMPNewsByTags(news CorpMPNews, tagIDs []string) error
- func (c *Client) CorpSendMPNewsByUsers(news CorpMPNews, userIDs []string) error
- func (c *Client) CorpSendMPNewsToAll(news CorpMPNews) error
- func (c *Client) CorpSendNewsByParties(news CorpNews, partyIDs []string) error
- func (c *Client) CorpSendNewsByTags(news CorpNews, tagIDs []string) error
- func (c *Client) CorpSendNewsByUsers(news CorpNews, userIDs []string) error
- func (c *Client) CorpSendNewsToAll(news CorpNews) error
- func (c *Client) CorpSendTextByParties(content string, partyIDs []string) error
- func (c *Client) CorpSendTextByTags(content string, tagIDs []string) error
- func (c *Client) CorpSendTextByUsers(content string, userIDs []string) error
- func (c *Client) CorpSendTextToAll(content string) error
- func (c *Client) CorpSendVideoByParties(video MPVideo, partyIDs []string) error
- func (c *Client) CorpSendVideoByTags(video MPVideo, tagIDs []string) error
- func (c *Client) CorpSendVideoByUsers(video MPVideo, userIDs []string) error
- func (c *Client) CorpSendVideoToAll(video MPVideo) error
- func (c *Client) CorpSendVoiceByParties(mediaID string, partyIDs []string) error
- func (c *Client) CorpSendVoiceByTags(mediaID string, tagIDs []string) error
- func (c *Client) CorpSendVoiceByUsers(mediaID string, userIDs []string) error
- func (c *Client) CorpSendVoiceToAll(mediaID string) error
- func (c *Client) CreateAgent(account, nickname, password string, isPlain bool) (err error)
- func (c *Client) CreateAgentSession(account, openId, text string) (err error)
- func (c *Client) CreateConditionalMenu(menu *Menu) (menuID int64, err error)
- func (c *Client) CreateCorpMenu(menu *Menu) error
- func (c *Client) CreateGroup(name string) (*Group, error)
- func (c *Client) CreateMenu(menu *Menu) error
- func (c *Client) CreateNews(news *News) (mediaId string, err error)
- func (c *Client) DeleteAgent(account string) (err error)
- func (c *Client) DeleteConditionalMenu(menuID *Menu) error
- func (c *Client) DeleteCroup(id string) error
- func (c *Client) DeleteMedia(mediaId string) (err error)
- func (c *Client) DeleteMenu() error
- func (c *Client) DeleteMsg(msgId int64) error
- func (c *Client) DownloadFile(u URL, req interface{}, filePath string, rep interface{}) (err error)
- func (c *Client) DownloadMedia(mediaId, filePath string) (err error)
- func (c *Client) DownloadTempMedia(mediaId, filePath string) error
- func (c *Client) DownloadVideo(mediaId, filePath string) (err error)
- func (c *Client) Get(u URL, rep interface{}) error
- func (c *Client) GetAgentMsgRecords(timeSpan *TimeSpan, pageIndex int, pageSize ...int) (records []MsgRecord, err error)
- func (c *Client) GetAgentSessionForCustomer(openId string) (session *AgentSession, err error)
- func (c *Client) GetAgentSessions(account string) (sessions []AgentSession, err error)
- func (c *Client) GetAgents() (agents []Agent, err error)
- func (c *Client) GetCorpDepartmentList(id ...int64) ([]CorpDepartment, error)
- func (c *Client) GetCorpUserList(departmentID int64, fetchChild ...bool) ([]CorpUser, error)
- func (c *Client) GetGroupByUser(openId string) (groupId int, err error)
- func (c *Client) GetGroups() ([]Group, error)
- func (c *Client) GetMediaCounts() (mediaCounts *MediaCounts, err error)
- func (c *Client) GetMediaList(mediaType string, offset, count int) (mediaList *MediaList, err error)
- func (c *Client) GetMenus() (menu *Menu, conditionalMenus []Menu, err error)
- func (c *Client) GetNews(mediaId string) (news *News, err error)
- func (c *Client) GetNewsList(offset, count int) (newsList *NewsList, err error)
- func (c *Client) GetOnlineAgents() (agents []OnlineAgent, err error)
- func (c *Client) GetUser(openId string, lang ...string) (*User, error)
- func (c *Client) GetUserList(nextId string) (*UserList, error)
- func (c *Client) GetUsers(openIds []string, lang ...string) ([]User, error)
- func (c *Client) GetVideo(mediaId string) (video *Video, err error)
- func (c *Client) GetWaitingAgentSessions() (totalCount int, sessions []AgentSession, err error)
- func (c *Client) IsMsgSent(msgId int64) (bool, error)
- func (c *Client) Oauth2GetToken(code, state string) (*Oauth2Token, error)
- func (c *Client) Oauth2GetTokenAndRedirect(code, state, redirectURL string) (string, error)
- func (c *Client) Oauth2GetUser(token, openID string) (*Oauth2User, error)
- func (c *Client) Oauth2Redirect(token *Oauth2Token, redirectURL string) (string, error)
- func (c *Client) Oauth2RefreshToken(refreshToken string) (*Oauth2Token, error)
- func (c *Client) Post(u URL, req, rep interface{}) error
- func (c *Client) SendCardAll(cardId, cardExt string, tagID ...int) (id int, err error)
- func (c *Client) SendCardByUsers(cardId, cardExt string, userIds []string) (id int, err error)
- func (c *Client) SendCardForPreview(cardId, cardExt, wxName string) (id int, err error)
- func (c *Client) SendImageAll(mediaId string, tagID ...int) (id int, err error)
- func (c *Client) SendImageByUsers(mediaId string, userIds []string) (id int, err error)
- func (c *Client) SendImageForPreview(mediaId, wxName string) (id int, err error)
- func (c *Client) SendNewsAll(mediaId string, tagID ...int) (id, dataId int, err error)
- func (c *Client) SendNewsByUsers(mediaId string, userIds []string) (id, dataId int, err error)
- func (c *Client) SendNewsForPreview(mediaId, wxName string) (id, dataId int, err error)
- func (c *Client) SendTemplateMessage(msg *TemplateMsg, values ...map[string]string) (msgID int64, err error)
- func (c *Client) SendTextAll(content string, tagID ...int) (id int, err error)
- func (c *Client) SendTextByUsers(content string, userIds []string) (id int, err error)
- func (c *Client) SendTextForPreview(content, wxName string) (id int, err error)
- func (c *Client) SendVideoAll(video MPVideo, tagID ...int) (id int, err error)
- func (c *Client) SendVideoByUsers(video MPVideo, userIds []string) (id int, err error)
- func (c *Client) SendVideoForPreview(video MPVideo, wxName string) (id int, err error)
- func (c *Client) SendVoiceAll(mediaId string, tagID ...int) (id int, err error)
- func (c *Client) SendVoiceByUsers(mediaId string, userIds []string) (id int, err error)
- func (c *Client) SendVoiceForPreview(mediaId, wxName string) (id int, err error)
- func (c *Client) UpdateAgent(account, nickname, password string, isPlain bool) (err error)
- func (c *Client) UpdateGroup(id string, name string) error
- func (c *Client) UpdateNews(mediaId string, index int, article *Article) (err error)
- func (c *Client) UpdateUserRemark(openId, remark string) error
- func (c *Client) UploadAgentHeadImage(account, filePath string) (err error)
- func (c *Client) UploadFile(u URL, name, filePath string, extraFields map[string]string, rep interface{}) error
- func (c *Client) UploadImage(filePath string) (*Media, error)
- func (c *Client) UploadMedia(mediaType, filePath string, extraFields ...map[string]string) (*Media, error)
- func (c *Client) UploadTempImage(filePath string) (*TempMedia, error)
- func (c *Client) UploadTempMedia(mediaType, filePath string) (*TempMedia, error)
- func (c *Client) UploadTempThumb(filePath string) (*TempMedia, error)
- func (c *Client) UploadTempVideo(filePath string) (*TempMedia, error)
- func (c *Client) UploadTempVoice(filePath string) (*TempMedia, error)
- func (c *Client) UploadThumb(filePath string) (*Media, error)
- func (c *Client) UploadVideo(title, intro, filePath string) (*Media, error)
- func (c *Client) UploadVoice(filePath string) (*Media, error)
- type Context
- func (c *Context) Abort()
- func (c *Context) Next()
- func (ctx *Context) ReplyImage(mediaId string)
- func (ctx *Context) ReplyMusic(music *Music)
- func (ctx *Context) ReplyNews(articles []ResponseArticle)
- func (ctx *Context) ReplyText(content string)
- func (ctx *Context) ReplyTransferToAgent(agentAccount ...string)
- func (ctx *Context) ReplyVideo(mediaId, title, description string)
- func (ctx *Context) ReplyVoice(mediaId string)
- func (c *Context) WriteResponse(rep interface{})
- type CorpArticle
- type CorpDepartment
- type CorpErr
- type CorpMPArticle
- type CorpMPNews
- type CorpNews
- type CorpUser
- type Err
- type Error
- type Event
- type EventHeader
- type File
- type Group
- type Handler
- type Image
- type MP
- type MPVideo
- type MatchRule
- type Media
- type MediaCounts
- type MediaList
- type Menu
- type MsgFilter
- type MsgRecord
- type Music
- type News
- type NewsList
- type Oauth2Token
- type Oauth2User
- type OnlineAgent
- type OpenId
- type ResponseArticle
- type Server
- func (srv *Server) GetAESKey() (string, string)
- func (srv *Server) GetToken() (string, string)
- func (srv *Server) GetVerifyFile(filename string, content []byte)
- func (srv *Server) HandleEvent(eventType string, handler Handler)
- func (srv *Server) HandleMessage(msgType string, handler Handler)
- func (srv *Server) SetAESKey(base64AESKey string)
- func (srv *Server) SetAppID(appID string)
- func (srv *Server) SetClient(client *Client)
- func (srv *Server) SetID(id string)
- func (srv *Server) SetToken(token string)
- func (srv *Server) Use(middlewares ...Handler)
- type TempMedia
- type TemplateMsg
- type TemplateMsgValue
- type Text
- type TextCard
- type TimeSpan
- type Token
- type TokenAccessor
- func (ta *TokenAccessor) RefreshTicket(usedTicket string) (ticket string, err error)
- func (ta *TokenAccessor) RefreshToken(usedToken string) (token string, err error)
- func (ta *TokenAccessor) Start()
- func (ta *TokenAccessor) Stop()
- func (ta *TokenAccessor) Ticket() (ticket string, err error)
- func (ta *TokenAccessor) Token() (token string, err error)
- type URL
- type User
- type UserList
- type Video
- type Voice
Constants ¶
View Source
const ( OpCreateSession = 1000 OpAcceptSession = 1001 OpInitiateSession = 1002 OpSwitchSession = 1003 OpCloseSession = 1004 OpRobSession = 1005 OpBackendRecvMessage = 2001 OpAgentSendMessage = 2002 OpAgentRecvMessage = 2003 )
View Source
const ( OK = 0 InvalidCredential = 40001 AccessTokenExpired = 42001 )
View Source
const ( MessageText = "text" MessageImage = "image" MessageVoice = "voice" MessageVideo = "video" MessageMusic = "music" MessageNews = "news" MessageEvent = "event" )
Received message types
View Source
const ( EventSubscribe = "subscribe" EventUnsubscribe = "unsubscribe" EventScan = "SCAN" EventLocation = "LOCATION" EventMenuClick = "CLICK" EventMenuView = "VIEW" EventCreateAgentSession = "kf_create_session" EventCloseAgentSession = "kf_close_session" EventSwitchAgentSession = "kf_switch_session" EventQualificationVerifySuccess = "qualification_verify_success" EventQualificationVerifyFail = "qualification_verify_fail" EventNamingVerifySuccess = "naming_verify_success" EventNamingVerifyFail = "naming_verify_fail" EventAnnualRenew = "annual_renew" EventVerifyExpired = "verify_expired" EventCardPassCheck = "card_pass_check" EventNotCardPassCheck = "card_not_pass_check" EventUserGetCard = "user_get_card" EventUserDelCard = "user_del_card" EventUserConsumeCard = "user_consume_card" EventUserPayFromPayCell = "user_pay_from_pay_cell" EventUserViewCard = "user_view_card" EventUserEnterSessionFromCard = "user_enter_session_from_card" EventUpdateMemberCard = "update_member_card" EventCardSkuRemind = "card_sku_remind" EventCardPayOrder = "card_pay_order" EventUserScanProduct = "user_scan_product" EventUserScanProductEnterSession = "user_scan_product_enter_session" EventUserScanProductAsync = "user_scan_product_async" EventUserScanProductVerifyAction = "user_scan_product_verify_action" EventShakeAroundUserShake = "ShakearoundUserShake" )
Event types for MessageEvent
View Source
const ( MediaImage = "image" MediaVoice = "voice" MediaVideo = "video" MediaThumb = "thumb" MediaNews = "news" )
View Source
const ( // 下面6个类型(包括view类型)的按钮是在公众平台官网发布的菜单按钮类型 ButtonTypeText = "text" ButtonTypeImage = "img" ButtonTypePhoto = "photo" ButtonTypeVideo = "video" ButtonTypeVoice = "voice" ButtonTypeView = "view" // 跳转URL ButtonTypeClick = "click" // 点击推事件 ButtonTypeMiniprogram = "miniprogram" // 小程序 // 下面的按钮类型仅支持微信 iPhone5.4.1 以上版本, 和 Android5.4 以上版本的微信用户, // 旧版本微信用户点击后将没有回应, 开发者也不能正常接收到事件推送 ButtonTypeScanCodePush = "scancode_push" // 扫码推事件 ButtonTypeScanCodeWaitMsg = "scancode_waitmsg" // 扫码带提示 ButtonTypePicSysPhoto = "pic_sysphoto" // 系统拍照发图 ButtonTypePicPhotoOrAlbum = "pic_photo_or_album" // 拍照或者相册发图 ButtonTypePicWeixin = "pic_weixin" // 微信相册发图 ButtonTypeLocationSelect = "location_select" // 发送位置 // 下面的按钮类型专门给第三方平台旗下未微信认证(具体而言, 是资质认证未通过)的订阅号准备的事件类型, // 它们是没有事件推送的, 能力相对受限, 其他类型的公众号不必使用 ButtonTypeMediaId = "media_id" // 下发消息 ButtonTypeViewLimited = "view_limited" // 跳转图文消息URL )
View Source
const ( MsgText = "text" MsgImage = "image" MsgVoice = "voice" MsgMPVideo = "mpvideo" MsgMPNews = "mpnews" MsgCard = "wxcard" MsgVideo = "video" // corp MsgFile = "file" // corp MsgNews = "news" // corp )
View Source
const ( SendAll = iota SendByUsers SendForPreview SendByParties // corp SendByTags // corp )
View Source
const ( LangZhCN = "zh_CN" LangZhTW = "zh_TW" LangEN = "en" )
View Source
const BLOCK_SIZE = 32
Variables ¶
View Source
var MaxMemoryForFile = 10 * 1024 * 1024
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { Id int64 `json:"kf_id"` Account string `json:"kf_account"` // identifier@account Nickname string `json:"kf_nick"` HeadImageURL string `json:"kf_headimgurl"` }
Customer Service Agent
type AgentSession ¶
type AgentSessionChange ¶
type Article ¶
type Article struct { ThumbId string `json:"thumb_media_id"` // permant media id of cover picture Title string `json:"title"` Author string `json:"author,omitempty"` Digest string `json:"digest,omitempty"` // only valid for single-article news Content string `json:"content"` // content, supporting HTML, no JS, less than 20000 chars or 1MB ContentSourceURL string `json:"content_source_url,omitempty"` // URL of "Read the original content" ShowCoverPic int `json:"show_cover_pic"` // whether show cover picture ThumbURL string `json:"thumb_url"` // cover picture URL, only valid for GetNews URL string `json:"url"` // content URL, only valid for GetNews }
Article of words and images
type Button ¶
type Button struct { Type string `json:"type,omitempty"` SubButtons []*Button `json:"sub_button,omitempty"` Name string `json:"name,omitempty"` // 菜单标题,不超过16个字节,子菜单不超过60个字节 Key string `json:"key,omitempty"` // 菜单KEY值,用于消息接口推送,不超过128字节 URL string `json:"url,omitempty"` // 网页链接,用户点击菜单可打开链接,不超过1024字节 MediaID string `json:"media_id,omitempty"` // 调用新增永久素材接口返回的合法media_id AppID string `json:"appid,omitempty"` // 小程序AppID(仅认证公众号可配置) PagePath string `json:"pagepath"` // 小程序的页面路径 }
func NewButtonForClick ¶
func NewButtonForMediaId ¶
func NewButtonForMiniprogram ¶
func NewButtonForPicSysPhoto ¶
func NewButtonForPicWeixin ¶
func NewButtonForView ¶
func NewButtonForViewLimited ¶
func NewButtonWithSubButtons ¶
type Client ¶
type Client struct { *TokenAccessor *http.Client AgentID int64 // corp app ID }
func NewCorpClient ¶
func (*Client) ChangeGroupForUser ¶
func (*Client) ChangeGroupForUsers ¶
func (*Client) CloseAgentSession ¶
func (*Client) CorpSendCardByParties ¶
func (*Client) CorpSendCardByTags ¶
func (*Client) CorpSendCardByUsers ¶
func (*Client) CorpSendCardToAll ¶
func (*Client) CorpSendFileByParties ¶
func (*Client) CorpSendFileByTags ¶
func (*Client) CorpSendFileByUsers ¶
func (*Client) CorpSendFileToAll ¶
func (*Client) CorpSendImageByParties ¶
func (*Client) CorpSendImageByTags ¶
func (*Client) CorpSendImageByUsers ¶
func (*Client) CorpSendImageToAll ¶
func (*Client) CorpSendMPNewsByParties ¶
func (c *Client) CorpSendMPNewsByParties(news CorpMPNews, partyIDs []string) error
func (*Client) CorpSendMPNewsByTags ¶
func (c *Client) CorpSendMPNewsByTags(news CorpMPNews, tagIDs []string) error
func (*Client) CorpSendMPNewsByUsers ¶
func (c *Client) CorpSendMPNewsByUsers(news CorpMPNews, userIDs []string) error
func (*Client) CorpSendMPNewsToAll ¶
func (c *Client) CorpSendMPNewsToAll(news CorpMPNews) error
func (*Client) CorpSendNewsByParties ¶
func (*Client) CorpSendNewsByTags ¶
func (*Client) CorpSendNewsByUsers ¶
func (*Client) CorpSendNewsToAll ¶
func (*Client) CorpSendTextByParties ¶
func (*Client) CorpSendTextByTags ¶
func (*Client) CorpSendTextByUsers ¶
func (*Client) CorpSendTextToAll ¶
func (*Client) CorpSendVideoByParties ¶
func (*Client) CorpSendVideoByTags ¶
func (*Client) CorpSendVideoByUsers ¶
func (*Client) CorpSendVideoToAll ¶
func (*Client) CorpSendVoiceByParties ¶
func (*Client) CorpSendVoiceByTags ¶
func (*Client) CorpSendVoiceByUsers ¶
func (*Client) CorpSendVoiceToAll ¶
func (*Client) CreateAgent ¶
func (*Client) CreateAgentSession ¶
func (*Client) CreateConditionalMenu ¶
func (*Client) CreateCorpMenu ¶
func (*Client) CreateMenu ¶
func (*Client) DeleteAgent ¶
func (*Client) DeleteConditionalMenu ¶
func (*Client) DeleteCroup ¶
func (*Client) DeleteMedia ¶
func (*Client) DeleteMenu ¶
func (*Client) DeleteMsg ¶
DeleteMsg deletes the mass message(only MsgMPNews and MsgMPVideo) which was sent in half an hour. It invalidates the message content page, but still retains the message card.
func (*Client) DownloadFile ¶
func (*Client) DownloadMedia ¶
func (*Client) DownloadTempMedia ¶
func (*Client) DownloadVideo ¶
func (*Client) GetAgentMsgRecords ¶
func (*Client) GetAgentSessionForCustomer ¶
func (c *Client) GetAgentSessionForCustomer(openId string) (session *AgentSession, err error)
func (*Client) GetAgentSessions ¶
func (c *Client) GetAgentSessions(account string) (sessions []AgentSession, err error)
func (*Client) GetCorpDepartmentList ¶
func (c *Client) GetCorpDepartmentList(id ...int64) ([]CorpDepartment, error)
func (*Client) GetCorpUserList ¶
func (*Client) GetGroupByUser ¶
func (*Client) GetMediaCounts ¶
func (c *Client) GetMediaCounts() (mediaCounts *MediaCounts, err error)
func (*Client) GetMediaList ¶
func (*Client) GetNewsList ¶
func (*Client) GetOnlineAgents ¶
func (c *Client) GetOnlineAgents() (agents []OnlineAgent, err error)
func (*Client) GetWaitingAgentSessions ¶
func (c *Client) GetWaitingAgentSessions() (totalCount int, sessions []AgentSession, err error)
func (*Client) Oauth2GetToken ¶
func (c *Client) Oauth2GetToken(code, state string) (*Oauth2Token, error)
func (*Client) Oauth2GetTokenAndRedirect ¶
func (*Client) Oauth2GetUser ¶
func (c *Client) Oauth2GetUser(token, openID string) (*Oauth2User, error)
func (*Client) Oauth2Redirect ¶
func (c *Client) Oauth2Redirect(token *Oauth2Token, redirectURL string) (string, error)
func (*Client) Oauth2RefreshToken ¶
func (c *Client) Oauth2RefreshToken(refreshToken string) (*Oauth2Token, error)
func (*Client) SendCardAll ¶
func (*Client) SendCardByUsers ¶
func (*Client) SendCardForPreview ¶
func (*Client) SendImageAll ¶
func (*Client) SendImageByUsers ¶
func (*Client) SendImageForPreview ¶
func (*Client) SendNewsAll ¶
func (*Client) SendNewsByUsers ¶
func (*Client) SendNewsForPreview ¶
func (*Client) SendTemplateMessage ¶
func (*Client) SendTextAll ¶
func (*Client) SendTextByUsers ¶
func (*Client) SendTextForPreview ¶
func (*Client) SendVideoAll ¶
func (*Client) SendVideoByUsers ¶
func (*Client) SendVideoForPreview ¶
func (*Client) SendVoiceAll ¶
func (*Client) SendVoiceByUsers ¶
func (*Client) SendVoiceForPreview ¶
func (*Client) UpdateAgent ¶
func (*Client) UpdateNews ¶
UpdateNews updates the index-th(0 based) article in the news which has media id mediaId.
func (*Client) UpdateUserRemark ¶
func (*Client) UploadAgentHeadImage ¶
func (*Client) UploadFile ¶
func (*Client) UploadMedia ¶
func (*Client) UploadTempImage ¶
func (*Client) UploadTempMedia ¶
func (*Client) UploadTempThumb ¶
func (*Client) UploadTempVideo ¶
func (*Client) UploadTempVoice ¶
func (*Client) UploadVideo ¶
type Context ¶
func (*Context) ReplyImage ¶
func (*Context) ReplyMusic ¶
func (*Context) ReplyNews ¶
func (ctx *Context) ReplyNews(articles []ResponseArticle)
func (*Context) ReplyTransferToAgent ¶
func (*Context) ReplyVideo ¶
func (*Context) ReplyVoice ¶
func (*Context) WriteResponse ¶
func (c *Context) WriteResponse(rep interface{})
type CorpArticle ¶
type CorpDepartment ¶
type CorpErr ¶
type CorpMPArticle ¶
type CorpMPArticle struct { Title string `json:"title"` Author string `json:"author,omitempty"` ThumbId string `json:"thumb_media_id"` // media id of cover picture ContentSourceURL string `json:"content_source_url,omitempty"` // URL of "Read the original content" Content string `json:"content"` // content, supporting HTML, no JS, less than 666KB Digest string `json:"digest,omitempty"` // content digest, less than 512B }
type CorpMPNews ¶
type CorpMPNews struct {
Articles []CorpMPArticle `json:"articles"`
}
type CorpNews ¶
type CorpNews struct {
Articles []CorpArticle `json:"articles"`
}
type Event ¶
type Event struct { EventHeader Event string `xml:"Event" json:"Event"` MsgId int `xml:"MsgId" json:"MsgId"` Content string `xml:"Content" json:"Content"` MediaId string `xml:"MediaId" json:"MediaId"` PicURL string `xml:"PicUrl" json:"PicUrl"` Format string `xml:"Format" json:"Format"` Recognition string `xml:"Recognition" json:"Recognition"` ThumbMediaId string `xml:"ThumbMediaId" json:"ThumbMediaId"` LocationX float64 `xml:"Location_X" json:"Location_X"` LocationY float64 `xml:"Location_Y" json:"Location_Y"` Scale int `xml:"Scale" json:"Scale"` Label string `xml:"Label" json:"Label"` Title string `xml:"Title" json:"Title"` Description string `xml:"Description" json:"Description"` URL string `xml:"Url" json:"Url"` EventKey string `xml:"EventKey" json:"EventKey"` Ticket string `xml:"Ticket" json:"Ticket"` Latitude float64 `xml:"Latitude" json:"Latitude"` Longitude float64 `xml:"Longitude" json:"Longitude"` Precision float64 `xml:"Precision" json:"Precision"` MenuId int `xml:"MenuId" json:"MenuId"` ScanCodeInfo *struct { ScanType string `xml:"ScanType" json:"ScanType"` ScanResult string `xml:"ScanResult" json:"ScanResult"` } `xml:"ScanCodeInfo,omitempty" json:"ScanCodeInfo,omitempty"` SendPicsInfo *struct { Count int `xml:"Count" json:"Count"` PicList []struct { PicMd5Sum string `xml:"PicMd5Sum" json:"PicMd5Sum"` } `xml:"PicList>item,omitempty" json:"PicList,omitempty"` } `xml:"SendPicsInfo,omitempty" json:"SendPicsInfo,omitempty"` SendLocationInfo *struct { LocationX float64 `xml:"Location_X" json:"Location_X"` LocationY float64 `xml:"Location_Y" json:"Location_Y"` Scale int `xml:"Scale" json:"Scale"` Label string `xml:"Label" json:"Label"` PoiName string `xml:"Poiname" json:"Poiname"` } `xml:"SendLocationInfo,omitempty" json:"SendLocationInfo,omitempty"` Status string `xml:"Status" json:"Status"` *AgentSessionChange ChosenBeacon *Beacon `xml:"ChosenBeacon,omitempty" json:"ChosenBeacon,omitempty"` AroundBeacons *Beacon `xml:"AroundBeacons>AroundBeacon,omitempty" json:"AroundBeacons,omitempty"` }
type EventHeader ¶
type MatchRule ¶
type MatchRule struct { GroupID *int64 `json:"group_id,omitempty"` Sex *int `json:"sex,omitempty"` Country string `json:"country,omitempty"` Province string `json:"province,omitempty"` City string `json:"city,omitempty"` ClientPlatformType *int `json:"client_platform_type,omitempty"` Language string `json:"language,omitempty"` }
type Media ¶
type Media struct { Id string `json:"media_id"` URL string `json:"url"` // only nonempty when media type is Image or Thumb, and only available on *.qq.com Name string `json:"name"` // only nonempty when call GetMediaList UpdateTime int64 `json:"update_time"` // only nonempty when call GetMediaList }
Permanent media
type MediaCounts ¶
type NewsList ¶
type NewsList struct { TotalCount int `json:"total_count"` ItemCount int `json:"item_count"` // item count of this time GetNewsList Items []struct { Id string `json:"media_id"` UpdateTime int64 `json:"update_time"` Content struct { Articles []Article `json:"news_item,omitempty"` } `json:"content"` } `json:"item"` }
type Oauth2Token ¶
type Oauth2User ¶
type Oauth2User struct { OpenID string `json:"openid"` Nickname string `json:"nickname"` Sex int `json:"sex"` Province string `json:"province"` City string `json:"city"` Country string `json:"country"` HeadImgURL string `json:"headimgurl"` Privilege []string `json:"privilege "` UnionID string `json:"unionid"` }
type OnlineAgent ¶
type OnlineAgent struct { Id int64 `json:"kf_id"` Account string `json:"kf_account"` // identifier@account Status int `json:"status"` // 1: PC Online, 2: Mobile Online, 3: PC and Mobile Online AutoAcceptNum int `json:"auto_accept"` // maximum number of auto accepting AcceptedCaseCount int `json:"accepted_case"` // count of accepted cases }
Online Customer Service Agent
type ResponseArticle ¶
type Server ¶
func (*Server) GetVerifyFile ¶
func (*Server) HandleEvent ¶
func (*Server) HandleMessage ¶
type TempMedia ¶
type TempMedia struct { Type string `json:"type"` Id string `json:"media_id"` CreatedAt int64 `json:"created_at"` }
Temporary media
type TemplateMsg ¶
type TemplateMsgValue ¶
type TimeSpan ¶
type TokenAccessor ¶
type TokenAccessor struct {
// contains filtered or unexported fields
}
func NewCorpTokenAccessor ¶
func NewCorpTokenAccessor(corpID, corpSecret string) (ta *TokenAccessor)
func NewTokenAccessor ¶
func NewTokenAccessor(appId, appSecret string, needsTicket bool) (ta *TokenAccessor)
func (*TokenAccessor) RefreshTicket ¶
func (ta *TokenAccessor) RefreshTicket(usedTicket string) (ticket string, err error)
func (*TokenAccessor) RefreshToken ¶
func (ta *TokenAccessor) RefreshToken(usedToken string) (token string, err error)
func (*TokenAccessor) Start ¶
func (ta *TokenAccessor) Start()
func (*TokenAccessor) Stop ¶
func (ta *TokenAccessor) Stop()
func (*TokenAccessor) Ticket ¶
func (ta *TokenAccessor) Ticket() (ticket string, err error)
func (*TokenAccessor) Token ¶
func (ta *TokenAccessor) Token() (token string, err error)
type URL ¶
type URL string
var BASE_URL URL = "https://api.weixin.qq.com/cgi-bin"
var CORP_BASE_URL URL = "https://qyapi.weixin.qq.com/cgi-bin"
type User ¶
type User struct { IsSubscriber int `json:"subscribe"` // 0 represents not a subscriber and the following infos do not exist OpenID string `json:"openid"` Nickname string `json:"nickname"` Sex int `json:"sex"` // 1: male, 2: female, 3: unknown Language string `json:"language"` // zh_CN, zh_TW, en City string `json:"city"` Province string `json:"province"` Country string `json:"country"` HeadImageURL string `json:"headimgurl"` SubscribeTime int64 `json:"subscribe_time"` UnionID string `json:"unionid,omitempty"` // exists only when the WeChat public account has been bound to WeChat open platform account Remark string `json:"remark"` GroupID int `json:"groupid"` }
Click to show internal directories.
Click to hide internal directories.