Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultChannelType = "groupRobot"
View Source
const DefaultToUser = "@all"
View Source
const DefaultsgType = "markdown"
View Source
const FullValidConfigForTesting = `` /* 270-byte string literal not displayed */
FullValidConfigForTesting is a string representation of a JSON object that contains all fields supported by the notifier Config. It can be used without secrets.
View Source
const FullValidSecretsForTesting = `{
"url": "http://localhost/test-url-secret"
}`
FullValidSecretsForTesting is a string representation of JSON object that contains all fields that can be overridden from secrets
View Source
const Version = schema.V1
Variables ¶
View Source
var Schema = schema.IntegrationSchemaVersion{ Version: Version, CanCreate: true, Options: []schema.Field{ { Label: "Webhook URL", Description: "Required if using GroupRobot", Element: schema.ElementTypeInput, InputType: schema.InputTypeText, Placeholder: "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx", PropertyName: "url", Secure: true, Required: true, DependsOn: "secret", Protected: true, }, { Label: "Agent ID", Description: "Required if using APIAPP, see https://work.weixin.qq.com/wework_admin/frame#apps create ApiApp", Element: schema.ElementTypeInput, InputType: schema.InputTypeText, Placeholder: "1000002", PropertyName: "agent_id", Required: true, DependsOn: "url", }, { Label: "Corp ID", Description: "Required if using APIAPP, see https://work.weixin.qq.com/wework_admin/frame#profile", Element: schema.ElementTypeInput, InputType: schema.InputTypeText, Placeholder: "wwxxxxxxxxx", PropertyName: "corp_id", Required: true, DependsOn: "url", }, { Label: "Secret", Description: "Required if using APIAPP", Element: schema.ElementTypeInput, InputType: schema.InputTypePassword, Placeholder: "secret", PropertyName: "secret", Secure: true, Required: true, DependsOn: "url", }, { Label: "Message Type", Element: schema.ElementTypeSelect, PropertyName: "msgtype", SelectOptions: []schema.SelectOption{ { Value: "text", Label: "Text", }, { Value: "markdown", Label: "Markdown", }, }, Placeholder: "Text", }, { Label: "Message", Description: "Custom WeCom message. You can use template variables.", Element: schema.ElementTypeTextArea, Placeholder: templates.DefaultMessageEmbed, PropertyName: "message", }, { Label: "Title", Element: schema.ElementTypeTextArea, InputType: schema.InputTypeText, Description: "Templated title of the message", PropertyName: "title", Placeholder: templates.DefaultMessageTitleEmbed, }, { Label: "To User", Element: schema.ElementTypeInput, InputType: schema.InputTypeText, Placeholder: "@all", PropertyName: "touser", }, }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Channel string `json:"-" yaml:"-"`
EndpointURL string `json:"endpointUrl,omitempty" yaml:"endpointUrl,omitempty"`
URL string `json:"url" yaml:"url"`
AgentID string `json:"agent_id,omitempty" yaml:"agent_id,omitempty"`
CorpID string `json:"corp_id,omitempty" yaml:"corp_id,omitempty"`
Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
MsgType MsgType `json:"msgtype,omitempty" yaml:"msgtype,omitempty"`
Message string `json:"message,omitempty" yaml:"message,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
ToUser string `json:"touser,omitempty" yaml:"touser,omitempty"`
}
func NewConfig ¶
func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (Config, error)
type MsgType ¶
type MsgType string
const MsgTypeMarkdown MsgType = "markdown" // use these in available_receivers.go too
const MsgTypeText MsgType = "text"
type Notifier ¶
Notifier is responsible for sending alert notifications to WeCom.
func (*Notifier) GetAccessToken ¶
GetAccessToken returns the access token for apiapp
func (*Notifier) SendResolved ¶
Click to show internal directories.
Click to hide internal directories.