Documentation
¶
Overview ¶
Please check the github Readme for an example of how to use this package. This package will help make sending notifications using WeChat Work 企业微信 easier. Make sure to refer to the api docs (chinese) to be able to know how to correctly configer each struct before sending the notification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
Title string `json:"title"`
Description string `json:"description"`
URL string `json:"url"`
PicURL string `json:"picurl"`
BtnTxt string `json:"btntxt"`
}
Article defines an article to be sent
type Config ¶
type Config struct {
CorpID string
CorpSecret string
SkipVerify bool
Debug bool
Notification Notification
}
Config is the minimum information you need to send a notification, CorpId and CorpSecret are used to get the access token required before sending a notification.
type File ¶
type File struct {
MediaId string `json:"media_id"`
}
File sends a file that needs to be uploaded to wechat work
type MpNews ¶
type MpNews struct {
MpNewsArticles []MpNewsArticle `json:"articles"`
}
Config is the minimum information you need to send a notification, CorpId and CorpSecret are used to get the access token required before sending a notification.
type MpNewsArticle ¶
type MpNewsArticle struct {
Title string `json:"title"`
Thumb_Media_ID string `json:"thumb_media_id"`
Author string `json:"author"`
Content_Source_Url string `json:"content_source_url"`
Content string `json:"content"`
Digest string `json:"digest"`
}
Config is the minimum information you need to send a notification, CorpId and CorpSecret are used to get the access token required before sending a notification.
type News ¶
type News struct {
Articles []Article `json:"articles"`
}
News is an array of articles to be sent
type Notification ¶
type Notification struct {
ToUser string `json:"touser"`
ToParty string `json:"toparty"`
ToTag string `json:"totag"`
MsgType string `json:"msgtype"`
Agentid int `json:"agentid"`
TextCard TextCard `json:"textcard"`
Text Text `json:"text"`
Image Image `json:"image"`
Voice Voice `json:"voice"`
Video Video `json:"video"`
File File `json:"file"`
News News `json:"news"`
MpNews MpNews `json:"mpnews"`
Safe int `json:"safe"`
}
Notification defines information about who to send the notification to, the type of message and the agentid of your wechat work application. The other structs are to define which notification to send. If you define both a TextCard and a Text but set the message type to "text" then only a text will be sent.
type Response ¶
type Response struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
}
Config is the minimum information you need to send a notification, CorpId and CorpSecret are used to get the access token required before sending a notification.
type TextCard ¶
type TextCard struct {
Title string `json:"title"`
Description string `json:"description"`
MsgURL string `json:"url"`
BtnTxt string `json:"btntext"`
}
TextCard is a text card that will be sent as a notification.
type Video ¶
type Video struct {
MediaId string `json:"media_id"`
Title string `json:"title"`
Description string `json:"description"`
}
Video sends a video with a title and description
type WeChatWork ¶
Config is the minimum information you need to send a notification, CorpId and CorpSecret are used to get the access token required before sending a notification.
func (WeChatWork) Exec ¶
func (p WeChatWork) Exec() error
Exec on a completed WeChatWork struct sends a message