Documentation ¶
Overview ¶
Token管理
message encryption and decryption
自定义菜单
客服信息
模板消息
Index ¶
- Variables
- func CustomMenuQuery(accesstoken string) error
- func Menu_Delete(accesstoken string) error
- func ServerToken() (string, error)
- func Service_Send_G(accesstoken, openid, content string) error
- func SignatureVerify(timestamp, nonce, remoteSignature, echostr string) string
- func TplMessage_Send_G(accesstoken, openid, time, content string) error
- type AccessTokenErrorResponse
- type AccessTokenResponse
- type Button
- type Content_Msg_Clear
- type Content_Msg_Safe
- type CustomButton
- type CustomMenu
- type ReqWechatTplData_Default
- type ReqWechatTplMiniprogramMsg
- type ReqWechatTplMsg
- type ReqWechatTpl_Alarm
- type ReqWechatTpl_Default
- type RespWechatTplMsg
- type Server
Constants ¶
This section is empty.
Variables ¶
var GAccessToken string
全局token变量
Functions ¶
func CustomMenuQuery ¶
查询当前自定义菜单 @accesstoken: 传入当前有效的token
func Service_Send_G ¶
客服消息:信息发送 @openid:发送对象的微信id @content:需要发送的文字
func SignatureVerify ¶
Verify signature @token: user token @timestamp: timestamp of verification request @nonce: nonce of verification request @echostr: the echo should be responded when verification passes @return: response message returned to wechat server directly
func TplMessage_Send_G ¶
/////////////// 自定义模块数据结构 ////////////////// 模板消息:信息发送 @openid:发送对象的微信id @time: 发送时间 @content:需要发送的文字
Types ¶
type AccessTokenErrorResponse ¶
微信服务器返回错误信息的格式
type AccessTokenResponse ¶
type AccessTokenResponse struct { AccessToken string `json:"access_token"` ExpiresIn float64 `json:"expires_in"` }
微信服务器返回token的格式
type Button ¶
type Button struct { Type string `json:"type;omitempty"` Name string `json:"name;omitempty"` Key string `json:"key;omitempty"` Url string `json:"url;omitempty"` }
button basic structure with compat on click mode and views mode
type Content_Msg_Clear ¶
type Content_Msg_Safe ¶
type Content_Msg_Safe struct { ToUserName string `xml:"ToUserName"` //消息发送者微信openid Encrypt string `xml:"Encrypt"` //加密内容 }
Message pattern(safe mode)
type CustomButton ¶
type CustomButton struct { Type string `json:"type;omitempty"` Name string `json:"name;omitempty"` Key string `json:"key;omitempty"` Url string `json:"url;omitempty"` SubButton []Button `json:"sub_button;omitempty"` }
button menu @name
type CustomMenu ¶
type CustomMenu struct { Url string Content []CustomButton }
custon menu requset structure
func MenuCreate ¶
func MenuCreate(accesstoken string, menuContent []CustomButton) (error, *CustomMenu)
url format: https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN
type ReqWechatTplData_Default ¶
type ReqWechatTplData_Default struct { Value string `json:"value"` //数据值 Color string `json:"color"` //颜色值 #173177 (蓝色) }
模板数据-官方默认
type ReqWechatTplMiniprogramMsg ¶
type ReqWechatTplMiniprogramMsg struct { AppId string `json:"appid"` //微信小程序id PagePath string `json:"pagepath"` //所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar) }
模板消息-微信小程序信息
type ReqWechatTplMsg ¶
type ReqWechatTplMsg struct { Touser string `json:"touser"` //接收人微信OpenId TempateId string `json:"template_id"` //模板ID 在微信公众平台后台生成 Url string `json:"url"` //消息内的跳转页面 Miniprogram ReqWechatTplMiniprogramMsg `json:"-"` //微信小程序信息 当前未使用 Data interface{} `json:"data"` //需要传入模板的数据 }
模板消息发送请求格式
type ReqWechatTpl_Alarm ¶
type ReqWechatTpl_Alarm struct { First ReqWechatTplData_Default `json:"first"` //首标题 KeyNote1 ReqWechatTplData_Default `json:"performance"` //数据块1 KeyNote2 ReqWechatTplData_Default `json:"time"` //数据块2 Remark ReqWechatTplData_Default `json:"remark"` //备注 可用于拓展 }
模板-告警2.2.1
type ReqWechatTpl_Default ¶
type ReqWechatTpl_Default struct { First ReqWechatTplData_Default `json:"first"` //首标题 KeyNote1 ReqWechatTplData_Default `json:"keynote1"` //数据块1 KeyNote2 ReqWechatTplData_Default `json:"keynote2"` //数据块2 KeyNote3 ReqWechatTplData_Default `json:"keynote3"` //数据块3 Remark ReqWechatTplData_Default `json:"remark"` //备注 可用于拓展 }
模板-官方默认
type RespWechatTplMsg ¶
模板消息响应格式
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
wechat server basic structure
func (*Server) CustomMenuCreate ¶
func (we *Server) CustomMenuCreate(menuContent []CustomButton) error
create cunstom menu
func (*Server) Service_Add ¶
客服消息:客服账号添加 @accesstoken:当前有效的token 未设置传参,可直接修改kf_account、nickname和password。注意kf_account格式是 【自定义客服名@微信公众号账号】
func (*Server) Service_Send ¶
客服消息:信息发送 @openid:发送对象的微信id @content:需要发送的文字
func (*Server) Token_Refresh ¶
func (we *Server) Token_Refresh()
刷新Token (刷新时间:1小时) @appid:微信后台的id号 @appsecret:微信后台开发的secret号