[BETA] Email Notification Templates

Currently, the new email notification template system is in a beta state. Much of its core functionality is in place. The system comes with a visual editor for creating the email templates. It utilizes a third-party component (https://grapesjs.com/) for this functionality.
Some features of the visual editor are still being customized to work correctly within trudesk.

If you wish to opt into using this beta feature you must enable it in the settings. If enabled it will pull the templates created when sending the notification. Because it is a beta feature I encourage users to get familiar with the visual editor and provide feedback before enabling.


Visual Editor

The visual editor features and capabilities are still being implemented fully into trudesk. Trudesk uses Handlebars as its main templating engine. When the email notifications are sent out it populates the handlebar variables with the object sent to the template. Each email template may receive a different object, thus requiring different variables.

The example below shows the new default “New Ticket” notification sent to users when a new ticket is created. This template receives the following object during runtime.

{
  "base_url": "http://docker.trudesk.io",
  "ticket": {
        "date": "2017-05-01T06:28:48.815Z",
        "deleted": false,
        "status": 1,
        "uid": 15025,
        "_id": "5906d5a0fe0710942be61c55"
        "tags": [
            {
                "_id": "57f887385881a1602ffc7063",
                "name": "34234"
            }
        ],
        "comments": [],
        "notes": [],
        "attachments": [],
        "history": [
            {
                "action": "ticket:created",
                "description": "Ticket was created.",
                "owner": {
                    "_id": "57f59e306067d1d40764bdb1",
                    "username": "demo.user",
                    "fullname": "Demo User",
                    "email": "demo@demo.com",
                    "role": "admin",
                    "title": "",
                    "image": "aProfile_demo.user.png"
                },
                "_id": "5906d5a0fe0710942be61c56",
                "date": "2017-05-01T06:28:48.818Z"
            }
        ],
        "subscribers": [],
        "updated": "2017-08-09T06:29:23.184Z",
        "assignee": {},
        "closedDate": null,
        "priority": {
           "name": "Normal",
           "htmlColor": "#29b955"
         },
        "group": {
            "_id": "57c4789c8bfd267c0383acd1",
            "name": "Administrators",
            "public": false,
            "sendMailTo": [
                "57c4789c8bfd267c0383acd2"
            ],
            "members": [
                "5896bccc67b4a730278e8fd6"
            ]
        },
        "issue": "<p>Issue Text</p>\n",
        "subject": "Subject Text",
        "type": {
            "_id": "57c4789c8bfd267c0383acd0",
            "name": "Task"
        },
        "owner": {
            "_id": "57f59e306067d1d40764bdb1",
            "username": "demo.user",
            "fullname": "Demo User",
            "email": "demo@demo.com",
            "role": "admin",
            "title": "",
            "image": "aProfile_demo.user.png"
        }
    }
}

As seen in the example below, in order to pull the object variables a handlebar variable is set inside the template.

1 Like