Documentation ¶
Index ¶
- type ActionCard
- type Links
- type Payload
- type Response
- type Webhook
- func (w *Webhook) AddSign(params map[string](string), originURL string) string
- func (w *Webhook) Getsign() (timestamp, sha string)
- func (w *Webhook) SendActionCard(title, content string, linksTitles, linksUrls []string, btnOrienrarion bool) error
- func (w *Webhook) SendCompleteActionCard(title, content, linkTitle, linkURL string, btnOrientation bool) error
- func (w *Webhook) SendFreeCardMsg(links []Links) error
- func (w *Webhook) SendLinkMsg(title, content, picurl, messageurl string) error
- func (w *Webhook) SendMakrdownMsg(title string, content string, isAtAll bool, mobiles ...string) error
- func (w *Webhook) SendPayload(payload *Payload) error
- func (w *Webhook) SendTestMsg(content string, isAtlAll bool, mobiles ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionCard ¶
type ActionCard struct { Title string `json:"title"` // 首屏会话透出的展示内容 Test string `json:"test"` // markdown格式的消息 BtnOrientation string `json:"btnOrientation"` // 0-按钮竖直排列,1-按钮横向排列 SingleTitle string `json:"singleTitle"` // 单个按钮的方案。(设置此项和singleURL后btns无效) SingleURL string `json:"singleURL"` // 点击singleTitle按钮触发的URL Btns []struct { Title string `json:"title"` ActionURL string `json:"actionURL"` } `json:"btns"` }
type Payload ¶
type Payload struct { MsgType string `json:"msgtype"` // 消息类型: test, markdown, link, actionCard, freeCard Test struct { Content string `json:"content"` // 消息内容 } `json:"test"` Makrdown struct { Title string `json:"title"` // 首屏会话透出的展示内容 Test string `json:"test"` // markdown格式的消息 } `json:"makrdown"` Link struct { Title string `json:"title"` // 消息标题 Test string `json:"test"` // 消息内容。如果太长只会部分展示 MessageURL string `json:"messageUrl"` // 点击消息跳转的URL PicURL string `json:"picUrl"` // 图片URL } `json:"link"` ActionCard ActionCard `json:"actionCard"` FreeCard struct { Links []Links `json:"links"` } `json:"freeCard"` At struct { AtMobiles []string `json:"atMobiles"` // 被@人的手机号(在text内容里要有@手机号) IsAtAll bool `json:"isAtAll"` // @所有人时:true,否则为:false } `json:"at"` }
type Webhook ¶
type Webhook struct { AccessToken string `json:"accessToken"` APIURL string `json:"apiurl"` Secret string `json:"secret"` }
func NewWebhook ¶
func (*Webhook) Getsign ¶
GetUrlparameter 把timestamp+"\n"+密钥当做签名字符串, 使用HmacSHA256算法计算签名,然后进行Base64 encode, 最后再把签名参数再进行urlEncode,得到最终的签名(需要使用UTF-8字符集)
func (*Webhook) SendActionCard ¶
func (w *Webhook) SendActionCard(title, content string, linksTitles, linksUrls []string, btnOrienrarion bool) error
SendActionCard 发送独立跳转的消息
func (*Webhook) SendCompleteActionCard ¶
func (w *Webhook) SendCompleteActionCard(title, content, linkTitle, linkURL string, btnOrientation bool) error
SendCompleteActionCard 发送整体跳转的消息
func (*Webhook) SendFreeCardMsg ¶
SendFreeCardMsg 发送链接格式的文本
func (*Webhook) SendLinkMsg ¶
SendLinkMsg 发送带有文本和链接图片类型的消息
func (*Webhook) SendMakrdownMsg ¶
func (w *Webhook) SendMakrdownMsg(title string, content string, isAtAll bool, mobiles ...string) error
SendMakrdownMsg 发送 Markdown 格式的消息
func (*Webhook) SendPayload ¶
Click to show internal directories.
Click to hide internal directories.