Documentation Guides
Merge tags and conditions
Let authors add recipient-specific text, links and layouts. Resolve them in your sending workflow.
On this page
Define merge tags
Set mergeTags in the dashboard or SDK. Each tag has a stable id, a label, the exact token your sending platform expects and a kind: text or url. sampleValue is optional and used only in previews.
// Run on your mounted editor instance.
editor.updateConfig({
mergeTags: [
{ id: 'first_name', label: 'First name', token: '{{first_name}}', kind: 'text', sampleValue: 'Alex' },
{ id: 'account_url', label: 'Account URL', token: '{{account_url}}', kind: 'url', sampleValue: 'https://example.com/account' },
],
});
const output = await editor.exportHTML();
console.log(output.mergeTags, output.mergeTagIssues);
// Exports retain literal tokens. Resolve recipient values before delivery.Define conditional layouts
Set displayConditions with an id, label, before and after. Use your sending platform’s opening and closing syntax. Authors apply a rule through Show when on a section or complete column layout. Nested layouts require every parent rule to match.
Weavour preserves the syntax; your sending system evaluates it. Scenario previews use sample outcomes and do not change normal exports. Conditions require SDK 0.1.6 or later and a compatible hosted editor.
editor.updateConfig({
displayConditions: [{
id: 'free_account', label: 'Free accounts', category: 'Account',
before: "{% if account.plan == 'free' %}", after: '{% endif %}',
}],
});
const output = await editor.exportHTML();
// Evaluate the host syntax before delivering HTML and plain text.
console.log(output.displayConditions, output.displayConditionIssues);
// Persist onDocumentChange envelopes; reopen with emailDocument.Update definitions without losing saved rules
SDK definitions merge by ID over dashboard definitions. [] adds no overrides; undefined clears SDK overrides. Saved tags and conditions keep their original syntax. Changing a definition does not rewrite existing emails.
Save the complete onDocumentChange envelope and reopen with emailDocument. Conditional emails use schemaVersion: 2; do not strip or downgrade that version.
Resolve personalization before sending
- Check mergeTagIssues and displayConditionIssues from exportHTML(). Review changed or unavailable definitions.
- Evaluate exported condition syntax and replace tokens in HTML, plain text, subject and preheader with your sending system.
- Alternatively, render saved JSON with mergeValues and boolean conditionValues from your backend.