Objective
- When an email template uses variables such as
{{recipient.first_name}}and multiple recipients are on the send, define one clear rule for which person those variables refer to. - Implement that rule so preview, sent mail, and builder UX all match—no conflicting “Hello Lisa” vs added-recipient behavior.
Background
- Reported behavior: preview can show one name while recipient list suggests another—operators lose trust in merge fields.
- Backend personalization flows through
renderEmailFromTemplateand per-recipient sends inattik-backend/src/util/functions/emailBuilder/renderEmail.ts, with recipient identity helpers insrc/util/functions/actionFlows/recipientIdentity.js(imported fromrenderEmail.ts). Variable substitution should stay consistent with whatever “primary recipient” or per-recipient pass is chosen.
Screen Recording 2026-05-01 at 11.54.11 AM.mov
Scope
Backend (attik-backend)
src/util/functions/emailBuilder/renderEmail.ts— merge-field resolution for multi-recipient batch and single-recipient sends; align preview endpoint behavior if one exists alongside production.src/util/functions/actionFlows/recipientIdentity.js— how “current recipient” is chosen for template blocks.
Frontend (attik-frontend)
- Email builder / preview surfaces that call preview APIs—ensure they pass the same recipient context the server uses.
References
attik-backend/src/util/functions/emailBuilder/renderEmail.tsattik-backend/src/util/functions/actionFlows/recipientIdentity.js