messengers

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

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 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 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"`
	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