Prospects: Listmonk mailing lists, and their opt-outs

Settings → Email → Mailing lists connects Listmonk (the Core's, by
default) with an API user and its token; Test reads the lists. A person
in Review can be added to a list, with their company, title and signal:
a double opt-in list asks them to confirm unless they already agreed; a
single opt-in list takes them only once they have; a suppressed address
is refused. Their card shows the lists they're on (a new list_members
table). Every hour, or on Sync now, everyone blocklisted in Listmonk or
unsubscribed from one of its lists goes on the suppression list, with
the reason; an address already there keeps its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 13:15:37 -07:00
co-authored by Claude Opus 5.5
parent a81ced3503
commit b6758417a3
14 changed files with 903 additions and 20 deletions
+31
View File
@@ -64,8 +64,39 @@
</div>
<div id="email-test"></div>
</section>
<form method="post" action="/settings/email/listmonk" autocomplete="off">
<section class="card" id="lists">
<h3>Mailing lists: Listmonk</h3>
<p class="small">Add a prospect to a newsletter or announcement list from Review (<em>Add to a mailing list</em>, on a person). Supermarket only adds people; Listmonk sends the campaigns. On a double opt-in list, Listmonk emails them to confirm unless you say they already agreed.</p>
<div class="cols">
<label>Listmonk's address <input name="listmonk_url" value="{{.Listmonk.URL}}" placeholder="https://listmonk.example.com"></label>
<label>API user <input name="listmonk_user" value="{{.Listmonk.User}}" placeholder="supermarket"><span class="help">In Listmonk: Admin → Users → New, type API, with a role that can manage subscribers and read lists.</span></label>
</div>
{{template "key-field" (dict "F" .LMToken "Set" .LMSet)}}
<div class="row">
<button type="submit" class="secondary small">Save</button>
{{if .LMSet}}<button hx-disabled-elt="this" type="button" class="secondary small" hx-post="/settings/email/listmonk/test" hx-target="#listmonk-test" hx-indicator="#testing-listmonk">Test</button>
<span id="testing-listmonk" class="htmx-indicator">Reading the lists…</span>{{end}}
</div>
<div id="listmonk-test"></div>
{{if .LMSet}}
<div class="row">
<button type="submit" class="secondary small" formaction="/settings/email/listmonk/sync" formnovalidate>Sync unsubscribes now</button>
<span class="small muted">Every hour, everyone blocklisted in Listmonk or unsubscribed from one of its lists goes on your <a href="/prospects/suppressed">suppression list</a>, so they're never added as a prospect or emailed in outreach again.</span>
</div>
{{with .OptOuts}}<p class="small {{if .Error}}error-text{{else}}muted{{end}}">Last synced {{ago .At}}: {{if .Error}}{{.Error}}{{else}}{{.Seen}} {{if eq .Seen 1}}person doesn't{{else}}people don't{{end}} want mail; {{.Added}} new on the suppression list.{{end}}</p>{{end}}
{{end}}
</section>
</form>
{{end}}{{template "settings-end"}}{{end}}
{{define "email-test"}}
<ul class="checks">{{range .}}<li class="{{if .OK}}ok{{else}}bad{{end}}">{{.Text}}</li>{{end}}</ul>
{{end}}
{{define "listmonk-test"}}
{{with .Error}}<ul class="checks"><li class="bad">{{.}}</li></ul>
{{else}}<ul class="checks"><li class="ok">It works: {{len .Lists}} {{if eq (len .Lists) 1}}list{{else}}lists{{end}}.</li></ul>
<ul class="small">{{range .Lists}}<li>{{.Name}} · {{.Type}}, {{if .Double}}double opt-in{{else}}single opt-in{{end}} · {{.Subscribers}} subscribers</li>{{end}}</ul>{{end}}
{{end}}