Mint campaign UTM links through the piha.li shortener.
CI / test (pull_request) Successful in 21s

Closes #9.

Auto-insert tracked homepage links in campaign compose, register them with
url_shortening_service, and put short piha.li URLs in SMS, email hrefs, and
postcard QR codes when SHORTENER_* is configured.
This commit is contained in:
2026-08-30 15:19:57 -05:00
parent dc0f3b2908
commit ef0655e8d5
17 changed files with 1082 additions and 4 deletions
+17
View File
@@ -35,6 +35,23 @@ webhook events match the correct recipient row. Invalid / missing header values
no longer 500 the endpoint (SMTP2GO “Test this webhook” often sends a sample
non-UUID).
## Campaign tracked links (UTM + piha.li)
Composer auto-inserts a homepage link:
| Param | Value |
|-------|--------|
| `utm_source` | `monica` |
| `utm_medium` | `email` / `sms` / `postcard` |
| `utm_campaign` | hyphenated campaign name |
When `SHORTENER_BASE_URL` + `SHORTENER_API_TOKEN` are set, the app POSTs that
long HTTPS URL to `url_shortening_service` (`POST /api/links/`, Bearer
`monica:<secret>`) and puts `short_url` (`https://piha.li/<code>`) in SMS,
email hrefs, and postcard QR codes. Empty env → long UTM URL (local default).
Mint against the **API host**, not `piha.li`. See `.env.example` / `.env.prod.example`.
SMS correlation uses `message_id` (SMS id), then `destination_number` phone
fallback. Do **not** treat webhook `id` as the SMS id.