Semplates Documentation

Find your answers below or shoot us an email.

Documentation / Template Design

/ Email Personalization - Using nested attributes

2 min read

Email Personalization - Using nested attributes

Learn how to organize complex customer data hierarchically and personalize your emails effortlessly using Handlebars syntax. Ideal for sending highly targeted and individualized content.

In Semplates, you can leverage the power of Handlebars to personalize your email templates with nested attributes. This feature allows you to organize complex customer data and refer to that data in your email templates.

What are Nested Attributes?

Nested attributes are attributes within attributes, allowing you to create a hierarchical structure for your data. For example, you can organize recipient data into several general categories, and within each of those categories, you can include detailed information.

Here's an example JSON structure for a single recipient:

{ "meta": { "userId": "51806220607" }, "user": { "firstName": "Pablo", "lastName": "Iyengar", "city": "Bengaluru", "country": "India", "postalCode": "560052", "personalOutlink": "" }, }

How to Use Nested Attributes in Semplates

In your email templates, you can refer to nested attributes by providing the name of the parent attribute, followed by a period (.), followed by the name of the attribute for which you want to include the value.

For example, if you use the data structure shown above and you want to include each recipient's first name in the email template, you can use the following Handlebars syntax:

Hello {{user.firstName}}!

Flexibility in Data Structure

Handlebars can parse paths that are nested several levels deep, which means you have flexibility in how you structure your template data.

Using nested attributes in Semplates

For this example, We will stick to a fictive banking company's communication material. Now we want to insert nested attributes into that communication template. In Semplates' Template Editor, you can use placeholder {{user.firstName}} such as the recipient's first name to appear, just like every other placeholder, in places such as plain text, link urls, image references, the subject line or preheader text.

Screenshot of the Semplates editor displaying the use of nested variables

Now, when opening the Template Preview, you can add used placeholders on the right site of the screen and review the rendered template on the left:

Screenshot of Semplates Preview Screen that showcases nested attributes

Insert some example values and hit the Update template button. The template view will update, using the provided placeholder values:

Screenshot of Semplates' preview screen that showcases parsed placeholders

Make sure to test your placeholders thoroughly to ensure that they behave as expected. Incorrectly set conditions could lead to irrelevant or confusing messages.

Important Notes

Pro Tip: Switch to the Expert Mode (available on Premium plans and above), to edit the expected JSON structure directly. This view is especially valuable, when working with complex or large placeholder payloads, and, when aligning your SES API calls to your template designs.

This guide provides you with the knowledge to use nested attributes in your Semplates email templates. We also explore other advanced personalization features like iterating through lists and using basic conditional statements.


Our cookie policy

We use cookie technology to analyse the website traffic and page usage, improve the navigation experience and support our marketing efforts. If you accept, you grant us permission to store cookies on your device for those purposes only.
Please read our Data Privacy Policy for more information.

Accept all

Only necessary