Skip to main content
Once you’ve built a recommendation algorithm in Maestra Platform, you can drop its output into any email template using the algorithm’s templater parameter. The parameter returns a collection of product objects, which you iterate over to render names, prices, images, and links.
If you use Maestra’s drag-and-drop email builder, you can add a recommendation block visually — no template code required. The steps below cover the case where you’re writing the template by hand.

Find the templater parameter

1

Open the algorithm

Go to Personalization → Product recommendations and open the algorithm you want to use in the email.
2

Copy the templater parameter

On the algorithm page, find the Templater parameter field. This is the variable name you’ll reference in the email template.
3

Open the email template

Open the email where you want the recommendations to appear and paste the parameter into the template where the recommendation block should render.
The recommendation parameter is a collection. You always access individual products through a for ... endfor loop — there’s no direct way to address a single item without iterating.
The simplest case — print the name and price of every recommended product in a vertical list. Replace recommendations with your algorithm’s templater parameter.
Inside the loop, each item exposes the product’s fields — name, price, URL, image, and any custom fields included in the algorithm output.

Example: lay out products in a grid (two per row)

To render the same eight products in a two-column table instead of a flat list, use the tableRows() helper to chunk the collection into rows.
tableRows(2) groups the products into rows of two. Change the number to control how many products appear per row.

Check whether recommendations exist

For some customers — typically those without enough behavior history — an algorithm may return an empty collection. Use the IsEmpty function to detect this case and fall back to alternative content, such as a popular-products block.
The fallback pattern is the most reliable way to guarantee an email never goes out with an empty recommendation block. Pair a personalized algorithm (which can return empty) with a popular-products algorithm (which almost always returns results) and you’re covered.