Define recipient variable behavior for multi-recipient emails

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 renderEmailFromTemplate and per-recipient sends in attik-backend/src/util/functions/emailBuilder/renderEmail.ts, with recipient identity helpers in src/util/functions/actionFlows/recipientIdentity.js (imported from renderEmail.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.ts
  • attik-backend/src/util/functions/actionFlows/recipientIdentity.js

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
🏠

Main App

Date

29 days ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.