rocketchat

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

RocketChat

文档 https://docs.rocket.chat/guides/administration/admin-panel/integrations

配置信息

关键配置 类型 rockatchat yaml读取 yaml可选
Webhook string webhook
  • Webhook: http://{{rockatchat.server}}/hooks/{{rocketchat.token}}

参数配置 类型 rockatchat yaml读取 yaml可选
Text string text text
title *string title title ✔
TitleLink *string title_link title ✔
ImageUrl *string image_url imageUrl ✔
Color *string color color ✔

调用

yaml
rocketchat:
  - notifyLevel: 1
    notifyFormatter: ["{{data}}"]
    webhook: "http://127.0.0.1:3000/hooks/62a6f649axxxxxxx/SdWX8fXKEs8xMBFxxxxxxx"
    text: "Hello from notify. {{data}}"
api
opt := rocketchat.Option{Webhook: "http://127.0.0.1:3000/hooks/62a6f649axxxxxxx/SdWX8fXKEs8xMBFxxxxxxx"}
opt.Text = "Hello from notify."
err := opt.ToNotifier().Send(nil)
if err != nil {
    fmt.Println(err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageParams

type MessageParams struct {
	Text      string  `yaml:"text" json:"text"`
	Title     *string `yaml:"title,omitempty" json:"title,omitempty"`
	TitleLink *string `yaml:"titleLink,omitempty" json:"title_link,omitempty"`
	ImageUrl  *string `yaml:"imageUrl,omitempty" json:"image_url,omitempty"`
	Color     *string `yaml:"color,omitempty" json:"color,omitempty"`
}

type Notifier added in v1.2.0

type Notifier struct {
	*Option
}

func (*Notifier) Send added in v1.2.0

func (n *Notifier) Send(messages []string) error

type Option

type Option struct {
	types.BaseOption `yaml:",inline"`
	Webhook          string `yaml:"webhook"`
	MessageParams    `yaml:",inline"`
}

func (*Option) ToNotifier

func (opt *Option) ToNotifier() *Notifier

Jump to

Keyboard shortcuts

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