Skip to main content

Configuring Email-Notification Templates

note

Custom email-notification templates are defined using the Django template syntax. Please refer to Django documentation for more information about creating Django templates.

Custom email-notification templates are specified in free-text, variables, and conditionals.

Variables are declared with the variable name surrounded in two sets of curly braces, for example:

{{application}}

You may also define conditional blocks that are only included in certain conditions. Conditional blocks are defined with the following syntax (replace condition with the boolean definition of when the block should be included, replace conditional content with the content that is only displayed when condition is true):

{% if condition %}conditional content{% endif %}

For example, the following adds the text Destinations have been modified by approvers when the currently-set destinations of the request do not match the destinations originally set by the requester:

{% if dest != orig_dest %}Destinations have been modified by approvers{% endif %}

Within a conditional block, you may also add an else clause to display content only when the condition is not satisfied:

{% if dest != orig_dest %}
Destinations have been modified by approvers
{% else %}
Destinations have not been modified by approvers
{% endif %}

Here is an example of a custom template that could be used to notify about completed requests. The example features free text, variables, and conditional blocks:

The following request submitted by {{requester}} has been completed successfully:

Request type: {{request_type}}
Request id: {{request_id}}
Comment: {{comment}}

Request affects the following targets:
{% if request_type == "authorization_request" %}
Source account: {{source}}
Destination account(s): {{dest}}
{% else %}
Application: {{application}}
{% endif %}

The following variables can be used for approval and request templates:

{{allow_from}}

List of allow-from options set in the request.

{{application}}

The name of the application that the request is associated to.

{{command}}

The command restriction specified in the request.

{{comment}}

The comment provided by the requester.

{{dest}}

List of destinations currently set for the request. For a list of originally-requested destinations, use {{orig_dest}} instead.

{{keyalg}}

The algorithm used to generate the key(s) this request applies to.

{{keysize}}

The size of the key(s) this request applies to.

{{kind}}

The type of the event. Such as Approval required, or Request completed.

{{message}}

The comment provided by a Key Manager administrator (when the request is denied).

{{not_after}}

The time after which the requested temporary authorizations are removed.

{{not_before}}

The time after which the requested temporary authorizations become usable.

{{orig_dest}}

List of destinations originally set by the requester.

{{orig_source}}

The source that was originally set by the requester.

{{request_type}}

The type of the request.

{{request_id}}

The numerical ID of the request.

{{requester}}

Contact information of the person who created the request.

{{source}}

The source currently set for the request.

{{tags}}

Tags associated to the request.


The following variables can be used for report-delivery templates:

{{application}}

The target application.

{{description}}

The report description.

{{name}}

The report name.

{{type}}

The report type.


The following variables can be used for Watchdog event templates:

{{event_id}}

The ID of the event.

{{Exception}}

The exception that triggered the event.

{{job_type}}

The type of the job that triggered the event.

{{level}}

The severity of the issue, such as ERROR or INFO.

{{name}}

The name of the event.

{{traceback}}

Stack trace from the event.

{{worker_class}}

The worker class.

{{worker_id}}

The ID of the worker.