webhook

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2021 License: MIT Imports: 13 Imported by: 4

README

DingTalk WebHook Golang SDK (Unofficial)

Build Status codecov

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCard

type ActionCard struct {
	Text           string `json:"text"`
	Title          string `json:"title"`
	SingleTitle    string `json:"singleTitle"`
	SingleURL      string `json:"singleUrl"`
	BtnOrientation string `json:"btnOrientation"`
	HideAvatar     string `json:"hideAvatar"` //  robot message avatar
	Buttons        []struct {
		Title     string `json:"title"`
		ActionURL string `json:"actionUrl"`
	} `json:"btns"`
}

ActionCard `action card message struct`

type LinkMsg

type LinkMsg struct {
	Title      string `json:"title"`
	MessageURL string `json:"messageUrl"`
	PicURL     string `json:"picUrl"`
}

LinkMsg `link message struct`

type PayLoad

type PayLoad struct {
	MsgType string `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
	Link struct {
		Title      string `json:"title"`
		Text       string `json:"text"`
		PicURL     string `json:"picURL"`
		MessageURL string `json:"messageUrl"`
	} `json:"link"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
	ActionCard ActionCard `json:"actionCard"`
	FeedCard   struct {
		Links []LinkMsg `json:"links"`
	} `json:"feedCard"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

PayLoad payload

type Response

type Response struct {
	ErrorCode    int    `json:"errcode"`
	ErrorMessage string `json:"errmsg"`
}

Response `DingTalk web hook response struct`

type WebHook

type WebHook struct {
	Secret string
	// contains filtered or unexported fields
}

WebHook `web hook base config`

func NewWebHook

func NewWebHook(accessToken string) *WebHook

NewWebHook `new a WebHook`

func (*WebHook) SendActionCardMsg

func (w *WebHook) SendActionCardMsg(title, content string, linkTitles, linkUrls []string, hideAvatar, btnOrientation bool) error

SendActionCardMsg `send single action card message`

func (*WebHook) SendLinkCardMsg

func (w *WebHook) SendLinkCardMsg(messages []LinkMsg) error

SendLinkCardMsg `send link card message`

func (*WebHook) SendLinkMsg

func (w *WebHook) SendLinkMsg(title, content, picURL, msgURL string) error

SendLinkMsg `send a link message`

func (*WebHook) SendMarkdownMsg

func (w *WebHook) SendMarkdownMsg(title, content string, isAtAll bool, mobiles ...string) error

SendMarkdownMsg `send a markdown msg`

func (*WebHook) SendTextMsg

func (w *WebHook) SendTextMsg(content string, isAtAll bool, mobiles ...string) error

SendTextMsg `send a text message`

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL