hedwig

module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: Unlicense

README

Hedwig

Standalone server for sending out notifications with pluggable service providers


Go Report Card

Background

This is a replacement for one of my project's notification server which was crudely based on serverless functions. The older implementation suffered from poor resilliancy and zero persistance. The other alternatives (shove) are not suitable for my use case where I change service providers regularly and want finer control over how messages are created.

The current design is based on Go plugins and follow a specific plugin spec. This allows for high flexibility and control over individual service clients. The compiled plugins are loaded during runtime and individual plugin configuration pulled from the config file.

Hedwig exposes a protected HTTP endpoint to enqueue incoming messages which are required to follow a common message spec.

Status: This project is currently undergoing development. Expect breaking changes (especially to plugins).

Features

  • Service providers are loaded as compiled Go plugins
  • Underlying resiliancy and persistance provided by asynq
  • Scheduled notifications
  • Queue from any source that talks HTTP

Plugins

Hedwig comes with a couple of sample plugins to give you an idea of how to write your own:

  • Telegram
  • Reddit
  • Mailgun

Usage

prerequisites

  • Go 1.6
  • Make
  • Redis server (add to config.json)
$ cp config.example.json config.json
# Edit config.json
$ make build
$ ./hedwig
# Hedwig will look for plugins in the root folder and load them at run time

Queue notifications by sending a request in the format:

Request:

> POST /push?key=test HTTP/1.1
> Host: localhost:3000
> Content-Type: application/json
> Accept: */*

| {
| 	"to": "135207785",
| 	"service": "telegram",
| 	"title": "hello from hedwig",
| 	"content": "test123",
| 	"delay": 1,
| 	"params": ["Markdown"]
| }

Response:

< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8

| {
|   "message": "6c9d0793-41e8-438c-9181-170af6a6da7f",
|   "ok": true
| }

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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