You will learn
Learn how to add a variable that dynamically populates a recipient’s first name in an email or SMS message. These are supported in campaigns and flows, in the body of a message, and in an email’s subject line.
Add a first name variable
- Open a message (i.e., email or SMS) in Klaviyo.
- Copy the following variable:
{{ first_name|default:'there' }}
- Paste the variable into any text field (e.g., an SMS message content field, an email subject line, or an email text block).
If you’re pasting into an email text block, make sure to paste the variable as plain text to avoid copying unwanted formatting into your message. To do so, right-click in the text field and select Paste and Match Style, Paste Without Formatting, Paste as Plain Text, or a similar message from the menu that appears.
Alternatively, use Control+Shift+V (PC) or Command+Shift+V (Mac) to paste as plain text.
Customize your first name variable
Choose a default value
The variable used in the steps above will populate as each recipient’s name when you send your message. If you don’t have a particular recipient’s name, it will be replaced with the word “there”, so the field won’t appear blank. So if your message contains the following text:
Hi {{ first_name|default:'there' }}
, have you seen our latest release?
Recipients whose first names aren’t stored in your database will receive this message:
Hi there, have you seen our latest release?
Choose a different default value by replacing “there” with another word or phrase.
Set consistent capitalization
If some names in your database are stored with unusual casing (e.g., all caps), use the title filter to make sure only the first letter is capitalized. For example, if a recipient’s first name is stored as ELISE in Klaviyo, the title filter will render it as Elise.
{{ first_name|title|default:'there' }}