mailroom

package module
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

mailroom

GitHub Release Go Reference go.mod LICENSE Build Status Go Report Card Codecov

Mailroom is a framework that simplifies the creation, routing, and delivery of user notifications based on events from external systems.

Flow diagram

Mailroom is designed to be flexible and extensible, allowing you to easily add new event types and transports as your needs grow and evolve. Simply write code to transform incoming events into notifications, and Mailroom will take care of the rest, including:

  • Acting as the primary notification relay for incoming webhooks from external systems
  • Sending notifications to the appropriate users based on their preferences (e.g. PR reviews go to email, but build failures go to Slack)
  • Formatting notifications for different transports (e.g. email, Slack, etc.)
  • Matching usernames, emails, IDs, etc. across different systems
  • Logging, error handling, retries, and more

See internal/example.go for an example of how to use mailroom.

Documentation

Also see the GoDoc for documentation.

Stability

Mailroom is currently in alpha. It works well in production, but the API may change at any time. We will do our best to note breaking changes in the release notes.

Contributing

See CONTRIBUTING.md for contribution guidelines.

Use make to run all linters and tests locally.

Documentation

Overview

Mailroom is a notification relay framework

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(s *Server)

func WithDefaultPreferences added in v0.4.0

func WithDefaultPreferences(prefs preference.Provider) Opt

WithDefaultPreferences sets the default preferences for the server

func WithListenAddr

func WithListenAddr(addr string) Opt

WithListenAddr sets the IP and port the server listens on, in the form "host:port"

func WithParser added in v0.4.0

func WithParser(key string, parser event.Parser) Opt

WithParser adds an event.Parser to the server with the given key. The key is used as the API endpoint for the server.

func WithParserAndGenerator added in v0.4.0

func WithParserAndGenerator(key string, parser event.Parser, generator event.Processor) Opt

WithParserAndGenerator is a convenience function that adds an event.Parser and its corresponding processor (which generates notifications) in a single call.

func WithProcessors added in v0.4.0

func WithProcessors(processors ...event.Processor) Opt

WithProcessors adds event.Processor instances to the server in the order given.

func WithRouter

func WithRouter(router *mux.Router) Opt

WithRouter sets the mux.Router used for the server

func WithTransports

func WithTransports(transports ...notifier.Transport) Opt

WithTransports adds notifier.Transport instances to the server

func WithUserStore

func WithUserStore(us user.Store) Opt

WithUserStore sets the user.Store for the server

type Server

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

Server is the heart of the mailroom application It listens for incoming webhooks, parses them, generates notifications, and dispatches them to users.

func New

func New(opts ...Opt) *Server

New returns a new server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the server in a Goroutine and blocks until the server is shut down. If the given context is canceled, the server will attempt to shut down gracefully.

Directories

Path Synopsis
pkg
event
Package event provides types and functions for working with incoming events
Package event provides types and functions for working with incoming events
identifier
Package identifier provides a way to identify users across different systems.
Package identifier provides a way to identify users across different systems.
notifier
Package notifier encapsulates the concept of sending a common.Notification via some Transport
Package notifier encapsulates the concept of sending a common.Notification via some Transport
notifier/slack
Package slack provides a notifier.Transport implementation for sending notifications to Slack
Package slack provides a notifier.Transport implementation for sending notifications to Slack
server
Package server provides the HTTP server for incoming events
Package server provides the HTTP server for incoming events
user
Package user provides types and functions for managing users who may want to receive notifications
Package user provides types and functions for managing users who may want to receive notifications
user/postgres
Package postgres provides a postgresql-backed implementation of the user.Store interface
Package postgres provides a postgresql-backed implementation of the user.Store interface

Jump to

Keyboard shortcuts

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