src

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogFail

func LogFail(channel, reason string)

LogFail prints a failure message: [HERMES] ✗ Webhook failed: timeout

func LogRetry

func LogRetry(channel string, attempt, max int)

LogRetry prints a retry warning: [HERMES] ⚠ SMS retrying... (attempt 2/3)

func LogSuccess

func LogSuccess(channel, recipient string, duration time.Duration)

LogSuccess prints a success message with timing: [HERMES] ✓ Email sent to admin@argus.tek (234ms)

func RenderTemplate

func RenderTemplate(templateDir, templateName string, data any) (string, error)

RenderTemplate reads a standard Go HTML template

Types

type ChannelType

type ChannelType string

ChannelType defines supported transport methods

const (
	Email   ChannelType = "email"
	SMS     ChannelType = "sms"
	Webhook ChannelType = "webhook"
)

type Config

type Config struct {
	Debug         bool
	MaxRetries    int           // Default: 0 (1 attempt, no retries)
	EmailProvider EmailProvider // Inject Mailgun, AWS, or SMTP here
	SMSProvider   SMSProvider   // Inject Twilio here
}

Config holds setup for the Hermes Engine

type EmailProvider

type EmailProvider interface {
	SendEmail(ctx context.Context, to, subject, htmlBody string) error
}

EmailProvider defines the interface for sending emails

type Engine

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

func New

func New(cfg Config) *Engine

New creates a new Hermes instance

func (*Engine) CheckHealth

func (e *Engine) CheckHealth() error

CheckHealth verifies external providers are reachable

func (*Engine) Send

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

Send dispatches a message via the requested channel with retry logic

type Message

type Message struct {
	Recipient string            `json:"recipient"`
	Subject   string            `json:"subject"` // Subject for Email, or Title for Push
	Body      string            `json:"body"`
	Channel   ChannelType       `json:"channel"`
	Metadata  map[string]string `json:"metadata,omitempty"` // Extra headers, webhook data, etc
}

Message is the generic payload for any notification

type SMSProvider

type SMSProvider interface {
	SendSMS(ctx context.Context, to, body string) error
}

SMSProvider defines the interface for sending SMS

Jump to

Keyboard shortcuts

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