How to use template tags in email templates
Last modified:
Available in service plans: Advanced, Universal
Template tags help to build your template. They add some prepared code to save time and simplify your template.
Syntax: {% template_tag_name arg_1 arg_2 ... %}
Find out below all available template tags. Please pay attention that some of them Required in some templates!
Common template tags
1. {% if %} ... {% else %} ... {% endif %} - Not required. Use this tag if you want to add some logic to your template. Example:
{% if notification.is_reply_allowed == True %}Reply{% else %}Do not reply{% endif %}
2. {% for %} ... {% empty %} ... {% endfor %} - Not required. Use this tag if you want to add some cycle to your template. Example:
{% for agent in notification.agents %}<br>{{agent.name}}{% empty %}No agents{% endfor %}
Template tags for "Base" template only!
1. {% ue_notification_styles %} - Not required. Add our prepared styles for HTML email templates. You can use our styles or add you own.
<style> ... UserEcho prepared stiles for email templates ... </style>
2. {% ue_delimiter %} - Required in "Base" template! Add special line to separate user replied text.
### Please type your reply above this line ###
3. {% ue_content %} - Required in "Base" template! Mark a place in the "Base" template where to add the notification text.
4. {% ue_unsubscribe %} - Required in "Base" template! Add a text how to unsubscribe from notification.
Available optional parameter:
- url_only - return url only. You are able to use our url and add your own text.
Examples:
- {% ue_unsubscribe %}
- {% ue_unsubscribe url_only=True %}
Available optional parameter:
- url_only - return url only. You are able to use our url and add your own text.
- {% ue_delivered_by %}
- {% ue_delivered_by url_only=True %}
Other template tags
1. {% ue_satisfaction %} - Recommended in "New comment/status" template! Cannot be used in other templates! Add a satisfaction module to the email. Ask user if he was satisfied with this support service.Available optional parameter:
- satisfied_url_only - return url only. You are able to use our url and add your own text.
- unsatisfied_url_only - return url only. You are able to use our url and add your own text.
- {% ue_satisfaction %}
- {% ue_satisfaction satisfied_url_only=True %}
- {% ue_satisfaction unsatisfied_url_only=True %}
Available optional parameters:
- label - label for a top line
- label_url - url for a top line
- header - bold text in common block
- text - regular text in common block
- {% ue_notification_frame %}
- {% ue_notification_frame label="UserEcho" label_url="http://userecho.com" %}
- {% ue_notification_frame label=notification.topic.header label_url = notification.url %}
3. {% ue_default_template %} - add default template for this type of message. This is very helpful if you add some if-else conditions to create a custom template for specific situations and want to show default template for another situations. The tag doesn't have any additional parameters.
Example:
- {% ue_default_template %}