Templates

A template is a fundamental content block which can be repeated for different users.
Templates in SuprSend group such block for multiple channels together under a single name. A template can have variables defined in it (eg. first name, booking amount, appointment date-time, recommendation item), which can get replaced with actual value for each user at the time of sending, making it repeatable.

Benefits of Templates with SuprSend:

  • For a communication, we have grouped templates for multiple channels together so that it becomes easy to manage the communication. You will know exactly what channels are live for a particular communication.
  • SuprSend lets you design and store templates on its platform, so that you can check the content and change the content without touching a single line of code. If your variables are the same, you can make changes in templates on the fly, and the next time communication will trigger, it will go with the updated template.
  • Designing template is a piece of cake with drag & drop and form editor format, so that your Product Managers and Designers can take control of the content instead of Developers.
  • To add any channel to your existing communication, you need to simply design a template for that channel on SuprSend platform, and immediately the communication will start on that channel.

Template Guidelines

1. Template Variables Language:

We use handlebarsjs as the template variables language. You can learn about handlebarsjs here.

2. Template Versions:

There is a default Draft version present for any channel, where you can make changes and save them before publishing them.
Whenever you draft is ready, you can publish the template by clicking on 'Publish Template'. This will create a Live Version. All communications will send this Live version to your users.

Everytime you publish a draft, a new live version is created. The Live version cannot be edit. To make changes, edit the Draft and Publish it as the newer version.
You can check the older versions by turning the toggle 'See live version only' on/off. SuprSend saves previous versions of templates to help you compare how your notification engagement has improved with changes in your template.

3. Template Slug Name:

You will require template slug name, when you are configuring workflow through API. To copy the slug name, click on the clipboard next to the Template name. You can create multiple templates with the same name, but this template slug will be unique for each template.



2880



Steps to Create New Template

  1. Click on the 'Templates' tab on left panel, you see a list of all templates (active and inactive) on this page. From here, click on 'New Template'
2880
2. On the New Template modal, add the Template name. For this case, we are creating a template with the name *'New User Registration Welcome' 808
3. Click on Save. The new Template will be created, which you can see on the 'Templates' page. 2880
4. Click on the template 'New User Registration Welcome', and start designing templates for all the channels that you like. See next section on best practices for each channel. 2880

How to add Dynamic Content in a template

There will always be cases where you would be required to add dynamic content to a template, so as to personalise it for your users. To achieve this, you can add variables in the template, which will be replaced with the dynamic content at the time of sending email. To send actual values to replace variables at the time of communication trigger, use one of our frontend or backend SDKs.

Here is a step by step guide on how to add dynamic content in a template:

Step 1: Declaring Variables in the global 'Variables' button:

We decided to follow Test Driven Development approach to set variables names in templates. In this approach, you define the variables first along with sample values in the global 'Variables' button provided in Template designing page. Once declared, the same variables can be used across all channels for that template.

2470
The variables are to be entered in `JSON` format. This JSON should be the same that you will send while triggering a workflow (it is a part of the `data` field). You can also add sample values, which will help you to see how your message will exactly look like when the variables are replaced with the data values. You can enter `array` variable names as well. Here is a sample of variables entered in JSON format.

Declaring variables before hand helps you in following ways:

  1. Often times there is a mismatch between template variables and the variables that come as part of payload of the trigger or event. Defining the JSON structure of variables before hand removes the chance that the template variables will be mismatched.
  2. The variables will come as auto-suggestions while designing the template. This will remove the chances of typo-errors.
  3. The same variables can be used across all channels templates, it gives a consistent and error-free experience.
  4. The sample values will be rendered in the preview, showing you how will the template look like.

1452

Step 2: Using variables in the templates:

Once the variables are declared, you can use them while designing template for any channel. We support handlebarsjs to add variables in the template. As a general rule, all the variables have to be entered within double curly brackets: {{variable_name}}

Note that you will be able to enter a variable name even when you have not declared it inside the 'Variables' button. To manually enter the variable name, follow the handlerbarsjs guide here.

There are slight differences between channels on how and where variables can be added in the template. Checkout each channel's template section next to see how to input variables while template designing.


What’s Next

See how to create templates for all channels