extension-email-marketing
Installation
SKILL.md
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-verificationandmops add caffeineai-authorization. - Stable state fields —
emailSubscribers : EmailSubscribers.StateandunsubscribeTokens : UnsubscribeTokens.State(plus the verification statesverifiedEmailsandverificationTokens), initialised in the migration chain head. - Mixin invocations —
include MixinEmailUnsubscribe(emailSubscribers, unsubscribeTokens)andinclude MixinEmailVerification(verifiedEmails, verificationTokens)inmain.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.sendMarketingEmailTotakes 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 aList-Unsubscribeheader pointing at the same page. - Frontend npm package and route —
@caffeineai/email-marketinginstalled, and a public route/unsubscribe(reachable without signing in) that renders a button callingconfirm().
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.