|
| 1 | +--- |
| 2 | +title: Listmonk Newsletter Integration |
| 3 | +weight: 1 |
| 4 | +--- |
| 5 | + |
| 6 | +Send newsletters to your subscribers by composing an email in neomd. Address it to a virtual trigger address (e.g. `listmonk@ssp.sh`), and neomd creates a [Listmonk](https://listmonk.app) campaign via API instead of sending via SMTP. Inspired by [HEY World](https://www.hey.com/world/). |
| 7 | + |
| 8 | +## How it works |
| 9 | + |
| 10 | +1. Compose an email as usual (`c`) |
| 11 | +2. Set the **To** field to a configured trigger address (e.g. `listmonk-newsletter@ssp.sh`) |
| 12 | +3. Write your newsletter in Markdown — it becomes the campaign body |
| 13 | +4. The pre-send screen shows **"Newsletter via Listmonk"** with the target list IDs and schedule delay |
| 14 | +5. Press `enter` — neomd creates a campaign in Listmonk and schedules it |
| 15 | + |
| 16 | +The campaign is created as a draft, then immediately set to `scheduled` status. Listmonk handles the actual delivery to your subscribers (via Amazon SES or whatever messenger you configured). |
| 17 | + |
| 18 | +## Configuration |
| 19 | + |
| 20 | +Add a `[listmonk]` section to your `config.toml`: |
| 21 | + |
| 22 | +```toml |
| 23 | +[listmonk] |
| 24 | +url = "https://list.ssp.sh" |
| 25 | +api_user = "sspaeti-api" |
| 26 | +api_token = "${LISTMONK_API_TOKEN}" |
| 27 | +delay_minutes = 30 |
| 28 | + |
| 29 | +[[listmonk.triggers]] |
| 30 | +address = "listmonk-newsletter@ssp.sh" |
| 31 | +list_ids = [2] |
| 32 | + |
| 33 | +[[listmonk.triggers]] |
| 34 | +address = "listmonk-book@ssp.sh" |
| 35 | +list_ids = [4] |
| 36 | + |
| 37 | +[[listmonk.triggers]] |
| 38 | +address = "listmonk@ssp.sh" |
| 39 | +list_ids = [2, 4] # send to all lists |
| 40 | +``` |
| 41 | + |
| 42 | +| Field | Description | |
| 43 | +|-------|-------------| |
| 44 | +| `url` | Base URL of your Listmonk instance | |
| 45 | +| `api_user` | API username for HTTP Basic Auth | |
| 46 | +| `api_token` | API token (supports `$ENV` expansion) | |
| 47 | +| `delay_minutes` | Minutes to delay before campaign sends (default 30) | |
| 48 | + |
| 49 | +### Trigger addresses |
| 50 | + |
| 51 | +Each `[[listmonk.triggers]]` entry maps a virtual email address to one or more Listmonk list IDs. You can configure multiple triggers to target different lists: |
| 52 | + |
| 53 | +- `listmonk-newsletter@ssp.sh` → sends to your newsletter list only |
| 54 | +- `listmonk-book@ssp.sh` → sends to your book subscribers only |
| 55 | +- `listmonk@ssp.sh` → sends to both lists at once |
| 56 | + |
| 57 | +The trigger address doesn't need to be a real mailbox — neomd intercepts it before any SMTP delivery. |
| 58 | + |
| 59 | +### Getting your list IDs |
| 60 | + |
| 61 | +List IDs are visible in the Listmonk admin UI, or via the API: |
| 62 | + |
| 63 | +```bash |
| 64 | +curl -u "admin:token" https://list.ssp.sh/api/lists | jq '.data.results[] | {id, name}' |
| 65 | +``` |
| 66 | + |
| 67 | +## Pre-send screen |
| 68 | + |
| 69 | +When the To address matches a trigger, the pre-send review changes: |
| 70 | + |
| 71 | +- Header shows **"Newsletter via Listmonk"** instead of "Ready to send" |
| 72 | +- Displays the target **list IDs** and **schedule delay** |
| 73 | +- Help bar shows `enter schedule campaign` instead of `enter send` |
| 74 | + |
| 75 | + |
| 76 | +### How it looks |
| 77 | + |
| 78 | +When sent in neomd: |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | +And in Listmonk itself: |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +## Content |
| 87 | + |
| 88 | +The email body (Markdown) is sent as-is with `content_type: "markdown"` — Listmonk converts it to HTML using its own template engine. The compose subject becomes the campaign subject. |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +## API details |
| 93 | + |
| 94 | +neomd uses two Listmonk API calls: |
| 95 | + |
| 96 | +1. `POST /api/campaigns` — creates campaign in DRAFT status with `send_at` set to now + `delay_minutes` |
| 97 | +2. `PUT /api/campaigns/{id}/status` — sets status to `scheduled` |
| 98 | + |
| 99 | +Authentication is HTTP Basic Auth. The campaign name is auto-generated as `"{subject} - {timestamp}"`. |
0 commit comments