Template overrides

The v3.29.0 release added a new TemplatesPath configuration option for overriding various HTML and plain-text templates in Elimity Insights. This article provides detailed information about how to use this feature. Correctly configuring TemplatesPath requires a technical background, so we recommend this feature only for advanced deployments.

The value of the TemplatesPath configuration option in elimity.yml (if provided) must be a path to an existing directory on the Elimity Insights server:

# TemplatesPath
# ----------------------------
#
# Data type: string
#
# Status: Optional
#
# Description: The directory path to use for overriding various HTML and plain-text templates in Elimity Insights.

The given directory must at least contain the following files:

  • access-review-welcome-screen.html.tmpl

  • link.html.tmpl

  • link.txt.tmpl

  • link-subject.txt.tmpl

These files should contain Go templates to customize various parts of Elimity Insights. There are multiple resources providing more information about Go templates, the official documentation is a good place to start. You should also take a look at Elimity Insights' default templates, which we use when the `TemplatesPath` configuration option is not set:

837B
Open

The following sections will explain the role of each template in more detail.

Customizing access review welcome screens

The access-review-welcome-screen.html.tmpl template allows customizing the contents of the first screen users see when opening an access review request link:

This template has access to the following variables:

Variable
Description
Type

.AssigneeName

Name of the access review's assignee

string

.CampaignName

Name of the access review's campaign

string

.CreatedAt

Timestamp indicating when the access review was created

time.Time

.DueDate

Timestamp indicating when the access review's campaign is due

time.Time

Customizing emails

The link.html.tmpl, link.txt.tmpl and link-subject.txt.tmpl templates allow customizing various emails sent by Elimity Insights. They represent the email's HTML body, TXT body and subject line respectively. More specifically, we use these templates for six types of emails:

  1. Invitations to new user accounts

  2. Requests to fill in an access review

  3. Reminders to fill in an access review

  4. Notifications about missing imports

  5. Requests to verify notification channels

  6. Notifications about stored query subscriptions

All three templates have access to all variables listed below, but some variables will only have a meaningful value for a specific type of email.

Common variables

The following variables always have a meaningful value regardless of the type of email:

Variable
Description
Value

.AccessReviewRequest

Indicates whether the current email is an access review request (or reminder)

bool

.Action

Label for the primary action button (e.g. "PERFORM ACCESS REVIEW" or "ACCEPT INVITE")

string

.FailedHealthCheck

Indicates whether the current email is a notification for missing imports

bool

.Header

Main header for the email (e.g. "Submit access review" or "Join Elimity Insights")

string

.NotificationChannelVerification

Indicates whether the current email is a notification channel verification request

bool

.NotificationTriggers

Lists all stored query subscriptions that triggered, empty slice if this email is not a notification about stored query subscriptions

[]notificationTrigger

.Subheader

Subheader for the email (e.g. "Your input is needed" or "You have been invited")

string

.TenantName

The name of your organization.

string

.Title

Main title for the email (e.g. "You have been requested to submit an access review" or "You are invited to Elimity Insights")

string

.URL

URL that the recipient should visit to perform the primary action (e.g. perform access review or accept invite)

string

renderNotificationCondition

Helper function to construct a textual description for the given notification trigger condition

func (notificationCondition) string

renderNotificationTriggerURL

Helper function to construct a link to the stored query page in Elimity Insights, for a given notification trigger

func (notificationTrigger) string

Variables for invitations

The following variables will only have a meaningful value if the email is an invitation (if .AccessReviewRequest and .FailedHealthCheck are both false):

Variable
Description
Type

.TenantName

The name of your organization

string

Variables for access review requests and access review reminders

The following variables will only have a meaningful value if the email is an access review request or an access review reminder (if .AccessReviewRequest is true):

Variable
Description
Type

.CampaignMeta

Map of the campaign's metadata as configured by the access review managers

map[string]string

.CampaignName

Name of the access review's campaign

string

.CreatorEmail

Email address of the access review's creator

string

.DueDate

Timestamp indicating when the access review's campaign is due

time.Time

.Reminder

Indicates whether the current email is a reminder for an access review request

bool

Variables for missing import notifications

The following variables will only have a value if the email is a notification about a missing import (if .FailedHealthCheck is true):

Variable
Description
Type

.HealthCheckSnapshotMaxAge

Maximum age of the snapshot in days for which imports are missing

int64

Variables for notification channel verifications

The following values will only have a value if the email is a request to verify a notification channel (if .NotificationChannelVerification is true):

Variable
Description
Type

.NotificationChannelDescription

Description of the notification channel

string

.NotificationChannelName

Name of the notification channel

string

Notification triggers

The .NotificationTriggers template variable lists all stored queries for which at least one subscription in the notification channel has triggered. Each element in this list is a notificationTrigger object with the following fields:

Field
Description
Type

AdditionCount

Number of added stored query results in the triggering history point

int64

Conditions

Lists all conditions that matched for this stored query

[]notificationCondition

HistoryPointID

Unique identifier of the history point that was added for this stored query

int64

QueryID

Unique identifier of this stored query

int64

QueryName

Name of this stored query

string

RemovalCount

Number of removed stored query results in the triggering history point

int64

Notification conditions

Each notification trigger refers to a stored query for which at least one subscription has triggered. The Conditions field of a notificationTrigger object lists precisely which subscriptions matched and why. Each element in this list is a notificationCondition object with the following fields:

Field
Description
Type

ResultsChangedAddition

Indicates whether the stored query subscription matched because new results were added. This field is only relevant if the Type field equals "results_changed"

bool

ResultsChangedMinPct

Indicates the minimum percentage of change in result count (added or removed) that was exceeded. This field is only relevant if the Type field equals "results_changed"

int64

ThresholdCrossedValue

Indicates the threshold value that was crossed (from either direction). This field is only relevant if the Type field equals "threshold_crossed"

int64

Type

Indicates which type of condition matched; one of "control_status_changed", "history_point_added", "results_changed" or "threshold_crossed"

string

Last updated