Smaller project

Listmonk automation

Multi-brand email automation for listmonk

Live

Problem
Listmonk sends newsletters well, but it has no automation, and one install can't keep several businesses apart.
Outcome
Open source. One install sends email for several brands, each with its own domain, tags, drip sequences, rules, and reports.
Stack
Go, PostgreSQL, Mermaid, Playwright, Docker
Links
hyvetech/listmonk (opens in a new tab)Docker Hub (opens in a new tab)

Listmonk is a fast, open-source newsletter and mailing list manager that you host yourself. It handles lists, campaigns, and tracking, but not automation. There are no subscriber tags, no drip sequences, and no “when they click this, send that”. One install serves one business.

My fork adds both. Built on listmonk v7.0.0-beta.1, it sends email for several unrelated businesses, which I call brands, from one install, and gives each one tags, drip sequences, rules, and funnel reports.

The sequence builder for a Welcome series in the Acme Coffee brand: settings on the left (name, list, trigger 'When someone subscribes to the list', re-entry options, and a send window with a time zone), and three steps on the right, sent right after enrollment and then 2 days apart, each with its sent count.The sequence builder for a Welcome series in the Acme Coffee brand: settings on the left (name, list, trigger 'When someone subscribes to the list', re-entry options, and a send window with a time zone), and three steps on the right, sent right after enrollment and then 2 days apart, each with its sent count. (full size)
A welcome sequence. Each step's email is an ordinary listmonk campaign, edited in the usual editor.

One install, many brands

Each brand is kept apart from the others:

  • It has its own domain, logo, favicon, From addresses, footer, and default template. Its domain serves only its own public pages (signup form, opt-in, unsubscribe, preferences, and archive), and every link in its emails, tracking and unsubscribe links included, uses that domain.
  • The admin lives on its own host. A brand switcher scopes every admin view, and admin users can be limited to certain brands.
  • One address can subscribe to several brands, but each brand sees only its own subscriptions, tags, and activity. Unsubscribing, deleting, or a subscriber’s own data export and wipe in one brand never touch another.
  • Another brand’s IDs get the same 404 as unknown ones, and the signup form answers the same way for new and existing addresses, so no brand reveals that an address exists elsewhere.
  • Lists can move between brands, with a dry run first. A separate listmonk install can be merged into a brand, and the links in emails it already sent keep working.
The settings page for the Northwind Books brand: name, slug, root URL, website, logo and favicon with a media library picker, and From addresses. Side panels show the DNS record to create for the brand's host and the SMTP server each From address routes to.The settings page for the Northwind Books brand: name, slug, root URL, website, logo and favicon with a media library picker, and From addresses. Side panels show the DNS record to create for the brand's host and the SMTP server each From address routes to. (full size)
A brand's settings, with the DNS record to create and the SMTP server each From address uses.

Automation

  • Tags per brand, added by hand, in bulk, by CSV import, through the API, by a hidden field on the signup form, or by rules, link clicks, and sequence steps.
  • Drip sequences, started on subscribe, on confirmation, by a tag, or by hand. Each has entry and exit conditions, a goal, and per-step delays, conditions, and actions. Send windows follow the sequence’s time zone, through daylight saving changes.
  • Sending through listmonk’s own pipeline, so sequence emails get the same rendering, SMTP routing, rate limits, and tracking as campaigns. A send interrupted by a crash is marked failed, never sent twice.
  • Rules: when something happens (a subscribe, a new tag, a click, a finished sequence), check the conditions, then add or remove tags, start or stop a sequence, or change lists. A test tool shows whether a rule would fire for a given subscriber, and why. Loops are guarded three ways: a run limit per rule, a cap on actions per subscriber per hour, and a cycle check when a rule is saved.
  • Link actions in the email editor: clicking a link can add a tag or start a sequence.
  • One condition language for tags, lists, attributes, clicks, opens, sequences, and subscription age. It compiles to SQL and is shared by sequences, rules, and subscriber search.

Reports

  • A report for each sequence: sent, opens, clicks, unsubscribes, and conversions per step, with exits by reason and top links.
  • Funnel reports across lists, sequences, tags, and clicks, with the conversion between each stage.
  • A funnel map of how a brand’s lists, tags, rules, and sequences connect, with live counts and loops highlighted.
  • Each subscriber’s sequences, rule runs, and event history.
The funnel map for a brand: a list feeds a Welcome series sequence; a 'Clicked offer' tag triggers a rule that stops the welcome series and enrolls the subscriber in an offer follow-up; a 'Customer' tag triggers a rule that adds a VIP tag. Each node shows its live count.The funnel map for a brand: a list feeds a Welcome series sequence; a 'Clicked offer' tag triggers a rule that stops the welcome series and enrolls the subscriber in an offer follow-up; a 'Customer' tag triggers a rule that adds a VIP tag. Each node shows its live count. (full size)
The funnel map: tags trigger rules, which start and stop sequences.

Keeping the fork maintainable

A fork is only useful if it can keep taking upstream releases. My code lives in its own packages, and my database migrations run on their own track after upstream’s. Clicks and opens are read from upstream’s tracking tables, so its handlers stay unchanged. Every edit to an upstream file is logged, with a checklist for the next rebase. The admin follows upstream’s server-rendered pages, with no new build pipeline.

It’s tested with Go unit and database tests, and a Playwright spec for each phase of the work.