How to Use SendGrid's Dynamic Templates for Your Transactional Emails


July 24, 2018
Written by
Ryan Darbonne
Contributor
Opinions expressed by Twilio contributors are their own

How to Use SendGrid's Dynamic Templates for Your Transactional Emails

Imagine it's time to update one of your transactional email templates. Whether you're updating a time-sensitive password reset, purchase receipt, registration confirmation, or any other type of communication, one thing remains true: the importance of transactional email templates to your business is critical.

It’s common and necessary to update transactional templates, but if your ESP lacks support for dynamic templating, it means that all of your templating logic has to be stored smack dab in the middle of your code. That also means a world of hassle.

Every small update, from an important structural edit to the tiniest change in button color, requires an entire battery of new tests and sign-offs, followed by a risky, white-knuckled deploy to your business-critical code base.

Sound exhausting? We thought so too.

We’re excited to introduce dynamic content for transactional templates which solves these challenges for developers and marketers alike.

Native support for Handlebars syntax

Those familiar with dynamic templating languages know that Handlebars is one of the most powerful, familiar syntaxes available to developers today. With SendGrid’s new dynamic content for transactional templates, we’ve brought native support for Handlebars syntax to templates sent over v3 of the SendGrid API.

These new templates unlock a world of functionality, including:
  • Iterating over lists of items (like products) to generate dynamic order confirmation or receipt messages
  • Basic conditionals, allowing you to serve targeted, relevant content based on recipient data
  • Deep object replacement, object failure protection, and more
Templates featuring this new functionality can be found and created by clicking “Transactional” under the “Templates” menu in the left-hand navigation. Any templates that existed prior to this release are still functional and can be found under the “Legacy” tab.

Test data for beautifully rendered previews

While curly brace brackets are beautiful on their own, in order to truly send with confidence, you need to be able to preview how an email will look when it hits the inbox.
When dynamic content requires you to render every email uniquely, this can often be a challenge.
Not anymore!

Dynamic transactional templates now feature a powerful new Test Data tab, located at the top of the editor, and are available at any time with just a click. Simply write or drop any bit of JSON you’d like into the tab, and your template will render a beautiful side-by-side preview, showing how your email will look once sent.

Insight for others, more time to focus

Think back to the last time you were tapped on the shoulder about your email templates. Maybe it was a member of another team asking about content or maybe it was a simple formatting change request. No matter what the scenario was, it likely disrupted your day and workflow.

Our new dynamic templates solve this issue too. When your templates are stored safely within SendGrid, your fellow teammates can peek behind the curtain of your transactional email program. That means fewer taps on the shoulder or drive-bys and more time to dial in and focus on your highest priorities.

Head on over to your account now to check out the templates, or start by reviewing the documentation!

*Note: Support for dynamic content is currently available only for mail sent using transactional templates over version 3 of the SendGrid API.

Recommended For You



Most Popular


Send With Confidence

Partner with the email service trusted by developers and marketers for time-savings, scalability, and delivery expertise.