We are setting up dynamic marketing campaigns in AutoSend and want to use conditional merge tags for first names. What is the exact syntax for Handlebars conditionals, what field names are used, and how do test emails resolve merge tags?
Conditional Merge Tag Syntax in AutoSend
AutoSend uses Handlebars-style template evaluation for marketing campaigns and automation sequences.
1. Conditional Syntax & Field Names
Field names are strictly camelCase (e.g., firstName, lastName, email). Use {{#if}}...{{else}}...{{/if}} to guard against missing values:
{{#if firstName}}
Hi {{firstName}}, welcome back!
{{else}}
Hello friend, welcome back!
{{/if}}
2. How Missing Properties Render
- If
firstNameis null or undefined and no{{else}}fallback is provided,{{firstName}}renders as a blank string (no uglyundefinedor[NULL]text in recipient inboxes).
3. How Test Emails Resolve Merge Tags
When triggering a Send Test Email preview:
- Existing Contact Data: If the test recipient address is already in your AutoSend contact list, real custom properties (
firstName, company) are injected into the preview. - Fallback Dummy Properties: If sending a test to an external address not in your audience database, supply sample contact property JSON in the test modal to preview both conditional branches (
#ifand{{else}}).
Tip: If you ever need to stop an active campaign mid-flight due to a template syntax bug, navigate to Campaigns → [Campaign Name] → Cancel Campaign.