webhook

package
v0.0.0-...-26a4605 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DingDingDisturbSpecifiedStaff

func DingDingDisturbSpecifiedStaff(ctx context.Context, req SendDingReportReq) error

钉钉告警

func SendDingRobot

func SendDingRobot(url string, content string, isAtAll bool) error

func SendDingRobotMD

func SendDingRobotMD(url string, title, text string, isAtAll bool, atMobiles ...string) error

支持Markdown格式的钉钉告警机器人 注意 在text内容里要有@人的手机号,且与atMobiles中的手机号一一对应才有用

Types

type DingResponse

type DingResponse struct {
	Errcode int
	Errmsg  string
}

type FeishuHooker

type FeishuHooker struct {
	// contains filtered or unexported fields
}

func NewFeishuHooker

func NewFeishuHooker(url string, opts ...Option) *FeishuHooker

func (*FeishuHooker) GenSign

func (f *FeishuHooker) GenSign(secret string, timestamp string) (string, error)

func (*FeishuHooker) SendRichTextMsg

func (f *FeishuHooker) SendRichTextMsg(content RichContent) error

func (*FeishuHooker) SendTextMsg

func (f *FeishuHooker) SendTextMsg(content string) error

type Hooker

type Hooker interface {
	SendTextMsg(content string) error

	SendRichTextMsg(content RichContent) error
	// contains filtered or unexported methods
}

type Option

type Option func(p Hooker)

func AtAll

func AtAll() Option

func Keyword

func Keyword(k string) Option

func Secret

func Secret(sc string) Option

type RichContent

type RichContent struct {
	Title   string              `json:"title"`
	Content [][]RichContentItem `json:"content"`
}

type RichContentItem

type RichContentItem struct {
	Tag    string `json:"tag"`
	Text   string `json:"text,omitempty"`
	Href   string `json:"href,omitempty"`
	UserID string `json:"user_id,omitempty"`
}

type SendDingReportReq

type SendDingReportReq struct {
	Url     string   `json:"url"`
	Content string   `json:"content"`
	All     bool     `json:"all"`
	Phones  []string `json:"phones"`
}

type SupportHookType

type SupportHookType int8
const (
	Feishu   SupportHookType = 1
	DingDing SupportHookType = 2
)

type TextMessage

type TextMessage struct {
	MsgType string     `json:"msgtype"`
	Text    TextParams `json:"text"`
	At      struct {
		AtMobiles []string `json:"atMobiles"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

TextMessage 发送钉钉消息

type TextParams

type TextParams struct {
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

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