senders

package
v0.1.97 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package senders delivers a notification to one channel, chosen by the type of the connection addressing it.

Each sender speaks its channel's own HTTP API directly. There is no router abstraction and no third-party dispatch library: a channel is a URL, a payload shape and a status code, and naming them explicitly is both smaller and easier to debug than a layer that hides them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportsAttachments

func SupportsAttachments(connectionType string) bool

SupportsAttachments reports whether a channel can carry a file. Only SMTP can, so a caller asking to attach anywhere else is refused up front.

Types

type Data

type Data struct {
	Title       string
	Message     string
	Properties  map[string]string
	Attachments []mail.Attachment
}

Data is the message to deliver.

Attachments are carried here but honoured only by SMTP — no chat channel accepts a file on its webhook. Callers must not silently rely on them elsewhere; ForConnection's documentation and the schedule spec's validation both say so, because a report that quietly failed to arrive is worse than one that refused to be configured.

type Discord

type Discord struct{}

Discord posts through an incoming webhook, either given whole as the connection URL or assembled from a webhook id and token.

func (*Discord) Send

func (d *Discord) Send(ctx context.Context, conn *models.Connection, data Data) error

type Mattermost

type Mattermost struct{}

Mattermost posts to an incoming webhook, with optional channel, username and icon overrides carried on the connection's properties.

func (*Mattermost) Send

func (m *Mattermost) Send(ctx context.Context, conn *models.Connection, data Data) error

type Ntfy

type Ntfy struct{}

Ntfy publishes to a topic, on ntfy.sh unless the connection names a host.

func (*Ntfy) Send

func (n *Ntfy) Send(ctx context.Context, conn *models.Connection, data Data) error

type Pushbullet

type Pushbullet struct{}

Pushbullet pushes a note using the connection's access token.

func (*Pushbullet) Send

func (p *Pushbullet) Send(ctx context.Context, conn *models.Connection, data Data) error

type Pushover

type Pushover struct{}

Pushover posts a form-encoded message for one user key.

func (*Pushover) Send

func (p *Pushover) Send(ctx context.Context, conn *models.Connection, data Data) error

type Sender

type Sender interface {
	Send(ctx context.Context, conn *models.Connection, data Data) error
}

Sender delivers one message to one channel.

func ForConnection

func ForConnection(conn *models.Connection) (Sender, error)

ForConnection returns the sender for a connection's type, or an error naming the type when there is none.

SMTP is deliberately absent: it is not a webhook, it is the only channel that carries attachments, and it is handled by the notification package's own SMTP path rather than here.

type Teams

type Teams struct{}

Teams posts a MessageCard to an incoming webhook.

func (*Teams) Send

func (t *Teams) Send(ctx context.Context, conn *models.Connection, data Data) error

type Telegram

type Telegram struct{}

Telegram sends one message per chat id. Chat ids are a comma-separated list on the connection username; the bot token is the password.

func (*Telegram) Send

func (t *Telegram) Send(ctx context.Context, conn *models.Connection, data Data) error

Jump to

Keyboard shortcuts

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