v1

package
v0.0.0-release-12.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const FullValidConfigForTesting = `` /* 149-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 = `{
	"api_secret": "test-secret-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 (
	// APIURL of where the notification payload is sent. It is public to be overridable in integration tests.
	APIURL = "https://msgapi.threema.ch/send_simple"
)
View Source
var Schema = schema.IntegrationSchemaVersion{
	Version:   Version,
	CanCreate: true,
	Options: []schema.Field{
		{
			Label:          "Gateway ID",
			Element:        schema.ElementTypeInput,
			InputType:      schema.InputTypeText,
			Placeholder:    "*3MAGWID",
			Description:    "Your 8 character Threema Gateway Basic ID (starting with a *).",
			PropertyName:   "gateway_id",
			Required:       true,
			ValidationRule: "\\*[0-9A-Z]{7}",
		},
		{
			Label:          "Recipient ID",
			Element:        schema.ElementTypeInput,
			InputType:      schema.InputTypeText,
			Placeholder:    "YOUR3MID",
			Description:    "The 8 character Threema ID that should receive the alerts.",
			PropertyName:   "recipient_id",
			Required:       true,
			ValidationRule: "[0-9A-Z]{8}",
		},
		{
			Label:        "API Secret",
			Element:      schema.ElementTypeInput,
			InputType:    schema.InputTypeText,
			Description:  "Your Threema Gateway API secret.",
			PropertyName: "api_secret",
			Required:     true,
			Secure:       true,
		},
		{
			Label:        "Title",
			Element:      schema.ElementTypeTextArea,
			InputType:    schema.InputTypeText,
			Description:  "Templated title of the message.",
			PropertyName: "title",
			Placeholder:  templates.DefaultMessageTitleEmbed,
		},
		{
			Label:        "Description",
			Element:      schema.ElementTypeTextArea,
			InputType:    schema.InputTypeText,
			Description:  "Templated description of the message.",
			PropertyName: "description",
			Placeholder:  templates.DefaultMessageEmbed,
		},
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	GatewayID   string `json:"gateway_id,omitempty" yaml:"gateway_id,omitempty"`
	RecipientID string `json:"recipient_id,omitempty" yaml:"recipient_id,omitempty"`
	APISecret   string `json:"api_secret,omitempty" yaml:"api_secret,omitempty"`
	Title       string `json:"title,omitempty" yaml:"title,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

func NewConfig

func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (Config, error)

type Notifier

type Notifier struct {
	*receivers.Base
	// contains filtered or unexported fields
}

Notifier is responsible for sending alert notifications to Threema.

func New

func New(cfg Config, meta receivers.Metadata, template *templates.Template, sender receivers.WebhookSender, images images.Provider, logger log.Logger) *Notifier

func (*Notifier) Notify

func (tn *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)

Notify send an alert notification to Threema

func (*Notifier) SendResolved

func (tn *Notifier) SendResolved() bool

Jump to

Keyboard shortcuts

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