Using Dynamic Content with the Amazon SES connector
Last updated
Last updated
Handlebars code can be used directly in Taxi Email Design Systems but there is a possibility of conflicts in some cases between html syntax and handlebars. The authors of Handlebars recommend using <script> tags around handlebars code to help with this.
As it’s not recommended to have script tags in the final delivered emails we recommend using a remove_outer rule as follows:
<script rule=””> #{{#if some_handlebars_var }} #{{some_more_handlebars_code}} #{{/if}} </script>
This results in the script being completely invisible in the editor in Taxi. Sometimes this can be confusing for users, so it is good practice to include a preview only placeholder to help give a good editor experience:
<taxi-preview-only>Membership-Number: Example1234</taxi-preview-only>
Personalisation fields for rich text
Personalisation fields can be set up in Taxi to help users add snippets of Handlebars code to their emails in the rich editor.
Select Dynamic Content you will then see the Personalisation tab. Personalisation appears in a dropdown in the rich editor, like this:
These show as placeholder text in the editor and preview (e.g. First Name), but as the relevant code at export.
Taxi has two constructs used for dynamic content called Segments and Segment sets. They are fully integrated with the SES connector. To associate Handlebars code with a segment or segment set first go to ‘Segmentation’ in the Dynamic Content menu
Next, navigate to the relevant segment set page and find your connector on the ‘Connectors’ tab:
If you have multiple connectors it is important to understand that the handlebars code is associated with the segment separately for each connector. This means your marketers can use the same audience categories but the underlying data mappings used can be adjusted for each platform you’re sending with.
To add handlebars code click the edit icon
The first thing to do is drag your preferred default segment to the last position, that’s because segments use an if /else if/ else structure. The ‘else’ content is used if none of the data matches, so this is the default.
Then add the conditions for each of your segments. Remember that unlike similar languages handlebars does not support tests like == or < or >. Therefore you can only test for the presence/truthiness of a variable. This part of the design philosophy of Handlebars. The intention is that these tests to be done in pre-processing and passed into the payload.
Read Next: Setting up the Amazon SES connector | Exporting to the Amazon SES connector