How to use context data in email templates

Last modified:


Available in service plans: Advanced, Universal



Each email template has own context data. To see all available context for selected notification click on "Available context" button. You will see some JSON data.


Example:

{
    "project": {
        "mail_footer": "", 
        "name": "UserEcho", 
        "is_white_labeled": false, 
        "alias": "feedback", 
        "logo": "/s/logos/1/1_1.png", 
        "id": 1
    }, 
    "notification": {
        "url": "", 
        "is_reply_allowed": false, 
        "user": {
            "rating": 245.02, 
            "name_and_title": "Vladimir Mullagaliyev (co-founder)", 
            "is_authenticated": true, 
            "is_staff": true, 
            "id": 3, 
            "date_joined": "2009-12-06T06:19:27Z", 
            "name": "Vladimir Mullagaliyev", 
            "language": "en", 
            "title": "co-founder", 
            "slug": "vladimir-mullagaliyev", 
            "avatar_url": "/s/cache/00/05/0005b4fa20ceaa5106e6b57582177c92.png", 
            "last_login": "2015-10-13T20:05:31.588Z"
        }
    }
}

To add some data from context to your template just place code {{path.to.context.variable}}


Example 1: if you would like to add user's name:


{{notification.user.name}}
Example 2: if you would like to add you project's logo:


<img src="{{project.logo}}" width="100" height="100">

This article was helpful for 17 people. Is this article helpful for you?
Report an error
Still need help? New ticket