messengers

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllSchemas added in v0.8.0

func GetAllSchemas() map[string]any

GetAllSchemas returns a map of all registered messenger names to their config schemas.

func GetChatNotifySchema added in v0.15.0

func GetChatNotifySchema() interface{}

func GetEmailNotifySchema added in v0.8.0

func GetEmailNotifySchema() interface{}

func GetWebhookNotifySchema added in v0.8.0

func GetWebhookNotifySchema() interface{}

func RegisterSchema added in v0.8.0

func RegisterSchema(name string, schema any)

RegisterSchema registers a messenger's config schema. Panics on duplicate.

Types

type ChatMessenger added in v0.15.0

type ChatMessenger struct {
	// contains filtered or unexported fields
}

func NewChatMessenger added in v0.15.0

func NewChatMessenger(cfg config.ChatConfig, logger *slog.Logger, rootURL string) (*ChatMessenger, error)

func (*ChatMessenger) Close added in v0.15.0

func (c *ChatMessenger) Close()

func (*ChatMessenger) Send added in v0.15.0

func (c *ChatMessenger) Send(ctx context.Context, msg Message) error

type ChatNotifyConfig added in v0.15.0

type ChatNotifyConfig struct {
	URL string `` /* 158-byte string literal not displayed */
}

type EmailMessenger

type EmailMessenger struct {
	// contains filtered or unexported fields
}

EmailMessenger sends emails using an SMTP connection pool

func NewEmailMessenger

func NewEmailMessenger(cfg config.SMTPConfig, groupResolver GroupResolver, logger *slog.Logger, rootURL string) (*EmailMessenger, error)

NewEmailMessenger creates a new EmailMessenger with the given SMTP configuration

func (*EmailMessenger) Close

func (e *EmailMessenger) Close()

Close closes the SMTP connection pool

func (*EmailMessenger) Send

func (e *EmailMessenger) Send(ctx context.Context, msg Message) error

Send sends an email message to receivers specified in msg.Config["receivers"]. Receivers can be email addresses or "group:name" references that are resolved via GroupResolver.

type EmailNotifyConfig added in v0.8.0

type EmailNotifyConfig struct {
	Receivers []string `json:"receivers" jsonschema:"title=Recipients,description=Users or groups to notify" jsonschema_extras:"widget=userselector"`
}

EmailNotifyConfig defines the messenger-specific configuration schema for email notifications.

type EventType added in v0.8.0

type EventType string

EventType identifies the kind of event a Message carries.

const (
	EventFlowExecution EventType = "flow.execution"
)

type FlowExecutionEvent added in v0.8.0

type FlowExecutionEvent struct {
	FlowID      string     `json:"flow_id"`
	FlowName    string     `json:"flow_name"`
	ExecID      string     `json:"exec_id"`
	Status      string     `json:"status"`
	Error       string     `json:"error"`
	Namespace   string     `json:"namespace"`
	TriggerType string     `json:"trigger_type"`
	TriggeredBy string     `json:"triggered_by"`
	StartedAt   *time.Time `json:"started_at,omitempty"`
	RootURL     string     `json:"-"`
}

FlowExecutionEvent carries structured data about a flow execution state change.

type GroupResolver added in v0.8.0

type GroupResolver interface {
	ResolveGroupEmails(ctx context.Context, groupName string) ([]string, error)
}

GroupResolver resolves a group name to a list of member email addresses.

type Message

type Message struct {
	Event  EventType
	Data   any
	Config map[string]any
}

Message is the generic struct passed to messengers.

type Messenger

type Messenger interface {
	Send(ctx context.Context, message Message) error
	Close()
}

type WebhookMessenger added in v0.8.0

type WebhookMessenger struct {
	// contains filtered or unexported fields
}

WebhookMessenger sends HTTP POST requests using the Standard Webhooks format.

func NewWebhookMessenger added in v0.8.0

func NewWebhookMessenger(cfg config.WebhookConfig, logger *slog.Logger) (*WebhookMessenger, error)

NewWebhookMessenger creates a new WebhookMessenger with the given configuration.

func (*WebhookMessenger) Close added in v0.8.0

func (w *WebhookMessenger) Close()

Close is a no-op for the webhook messenger.

func (*WebhookMessenger) Send added in v0.8.0

func (w *WebhookMessenger) Send(_ context.Context, msg Message) error

Send posts the message to the URL specified in msg.Config["url"] using Standard Webhooks headers.

type WebhookNotifyConfig added in v0.8.0

type WebhookNotifyConfig struct {
	URL string `json:"url" jsonschema:"title=Webhook URL,description=URL to POST webhook notifications to"`
}

WebhookNotifyConfig defines the per-flow webhook configuration rendered in the UI.

Jump to

Keyboard shortcuts

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