notify

package
v0.0.0-...-bde0b67 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package notify provides external notification channels for escalations. Channels include email (SMTP), SMS (Twilio), Slack (webhook), and log files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notification

type Notification struct {
	ID          string // Escalation ID
	Severity    string // critical, high, medium, low
	Title       string // Short description
	Body        string // Full message body
	Source      string // Who triggered this (agent ID)
	RelatedBead string // Related bead ID if any
	Timestamp   time.Time
}

Notification contains the data to send through notification channels.

type Result

type Result struct {
	Channel string // email, sms, slack, log
	Success bool
	Error   error
	Message string // Human-readable status
}

Result captures the outcome of a notification attempt.

func SendEmail

func SendEmail(to string, n *Notification) *Result

SendEmail sends an email notification via SMTP.

func SendSMS

func SendSMS(to string, n *Notification) *Result

SendSMS sends an SMS notification via Twilio.

func SendSlack

func SendSlack(webhookURL string, n *Notification) *Result

SendSlack posts a notification to a Slack webhook.

func WriteLog

func WriteLog(townRoot string, n *Notification) *Result

WriteLog writes the notification to an escalation log file.

type SMTPConfig

type SMTPConfig struct {
	Host     string
	Port     string
	Username string
	Password string
	From     string
}

SMTPConfig holds SMTP server configuration. Loaded from environment variables:

  • GT_SMTP_HOST: SMTP server hostname (default: localhost)
  • GT_SMTP_PORT: SMTP server port (default: 25)
  • GT_SMTP_USER: SMTP username (optional)
  • GT_SMTP_PASS: SMTP password (optional)
  • GT_SMTP_FROM: From address (default: gongshow@localhost)

func LoadSMTPConfig

func LoadSMTPConfig() *SMTPConfig

LoadSMTPConfig loads SMTP configuration from environment variables.

type TwilioConfig

type TwilioConfig struct {
	AccountSID string
	AuthToken  string
	FromNumber string
}

TwilioConfig holds Twilio API configuration. Loaded from environment variables:

  • TWILIO_ACCOUNT_SID: Twilio account SID
  • TWILIO_AUTH_TOKEN: Twilio auth token
  • TWILIO_FROM_NUMBER: Phone number to send from

func LoadTwilioConfig

func LoadTwilioConfig() *TwilioConfig

LoadTwilioConfig loads Twilio configuration from environment variables.

Jump to

Keyboard shortcuts

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