back
loading skill details...
Send personalised marketing emails to subscribers with an unsubscribe link.
Email — Marketing
Marketing email extension for Caffeine AI.
Overview
This skill adds direct marketing email support with subscriber management, topic-based subscriptions, and unsubscribe links that land on the app's own frontend. The backend mints one unsubscribe token per subscriber and topic (unsubscribeTokens) and handles it through MixinEmailUnsubscribe; the frontend renders the /unsubscribe page, where the recipient clicks a button to unsubscribe. Requires email verification before users can receive marketing emails.
Required Setup Checklist
All six steps are mandatory.
mops dependencies — mops add caffeineai-email-marketing, mops add caffeineai-email-verification and mops add caffeineai-authorization.
Stable state fields — emailSubscribers : EmailSubscribers.State and unsubscribeTokens : UnsubscribeTokens.State (plus the verification states verifiedEmails and verificationTokens), initialised in the migration chain head.
Mixin invocations — include MixinEmailUnsubscribe(emailSubscribers, unsubscribeTokens) and include MixinEmailVerification(verifiedEmails, verificationTokens) in main.mo.
Sending — EmailMarketing.sendMarketingEmail(emailSubscribers, verifiedEmails, unsubscribeTokens, topicId, fromUsername, subject, htmlBody, personalise) sends to every verified subscriber of the topic; the app never assembles the recipient list. sendMarketingEmailTo takes explicit addresses and sends to those of them that are verified subscribers of the topic.
Unsubscribe link — the body should contain {{UNSUBSCRIBE_URL}}; when it is missing an unsubscribe line is appended. Every copy also carries a List-Unsubscribe header pointing at the same page.
Frontend npm package and route — @caffeineai/email-marketing installed, and a public route /unsubscribe (reachable without signing in) that renders a button calling confirm().
CRITICAL: the unsubscribe link is https://<app domain>/unsubscribe?token=…. Without the frontend route the recipient lands on a missing page and cannot unsubscribe, which is a compliance failure.don't have the plugin yet? install it then click "run inline in claude" again.