wecom

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

Wecom Notification Plugin

How to use

To use the notification-wecom plugin with your application, install it using the following command:

./answer build --with github.com/lhui/incubator-answer-plugins/notification-wecom

Feature

  • Send message to Wecom

Config

Config Webhook URL and open the notification

  • Webhook URL: such as https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Preview

Wecom Config

Document

https://open.work.weixin.qq.com/help2/pc/14931 https://developer.work.weixin.qq.com/document/path/91770

Thanks

Thanks for sharing the DingTalk notification plugin, it's a helpful reference for this plugin development.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Info embed.FS

Functions

This section is empty.

Types

type Notification

type Notification struct {
	Config          *NotificationConfig
	UserConfigCache *UserConfigCache
}

func (*Notification) ConfigFields

func (n *Notification) ConfigFields() []plugin.ConfigField

func (*Notification) ConfigReceiver

func (n *Notification) ConfigReceiver(config []byte) error

func (*Notification) GetNewQuestionSubscribers

func (n *Notification) GetNewQuestionSubscribers() (userIDs []string)

GetNewQuestionSubscribers returns the subscribers of the new question notification

func (*Notification) Info

func (*Notification) Info() plugin.Info

func (*Notification) Notify

func (n *Notification) Notify(msg plugin.NotificationMessage)

Notify sends a notification to the user

func (*Notification) UserConfigFields

func (n *Notification) UserConfigFields() []plugin.ConfigField

func (*Notification) UserConfigReceiver

func (n *Notification) UserConfigReceiver(userID string, config []byte) error

type NotificationConfig

type NotificationConfig struct {
	Notification bool `json:"notification"`
}

type UserConfig

type UserConfig struct {
	WebhookURL                   string `json:"webhook_url"`
	InboxNotifications           bool   `json:"inbox_notifications"`
	AllNewQuestions              bool   `json:"all_new_questions"`
	NewQuestionsForFollowingTags bool   `json:"new_questions_for_following_tags"`
}

type UserConfigCache

type UserConfigCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewUserConfigCache

func NewUserConfigCache() *UserConfigCache

func (*UserConfigCache) SetUserConfig

func (ucc *UserConfigCache) SetUserConfig(userID string, config *UserConfig)

type WebhookReq

type WebhookReq struct {
	MsgType  string `json:"msgtype"`
	Markdown struct {
		Text string `json:"content"`
	} `json:"markdown"`
}

func NewWebhookReq

func NewWebhookReq(content string) *WebhookReq

Directories

Path Synopsis
* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements.
* Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements.

Jump to

Keyboard shortcuts

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