How to use template-specific Jinja variables with Snippets

Recently, we received a question from a customer that prompted us to scratch our heads for a few seconds: “How can I use template-specific variables that aren’t passed into the data field of the API to send mail?” We did some research and devised a pretty simple and interesting solution.

The idea is to set up a Snippet which includes a variable of your choosing. Then you can set that Jinja variable separately in each template.

Snippet Setup

You can insert a variable into the snippet that will be pulled from the template