Basic concepts for creating a Notification Template

Tabla de contenidos

This article explains basic concepts for creating an Athento notification template and using it in operations that send email notifications, such as Send document and metadata by email.

Access the email notification administration

You can access it from the advanced administration, in the Notifications section:

Home >> Notifications >> Notification templates

Click the "+" icon to add a new notification. Then, complete the required basic information.

Use dynamic information in the subject or in the email body

If in Subject, in Body or in both you are going to use variables that are replaced when generating the notification, add this tag at the beginning of each block in which variables are used:

{% load filetags %}

Useful tags that you can use in a Notification Template:

{{fil.filename}} -> Document title

{{fil.uuid}} -> Document internal identifier

{{fil|gmv:"metadata.field1"}} ->

Prints the value of a field. Replace "field1" with the API name of the field you want to print.

{{fil|gmv:"metadata.field1"|safe}} ->

Prints the value of a field indicating that it is safe to process that content. It is useful when the value includes HTML code, for example, in rich text fields. Replace "field1" with the API name of the field you want to print.

{{fil.id|gmv_printable:"metadata.field2"}} ->

Use this tag when working with dictionary-type fields, document, users, etc.

{{series.team.get_absolute_logo_url}} ->

To display the team logo.

{{fil.id|gmvp_currency: "metadata.field2"}} -> Prints a numeric currency field.

{{fil.doctype.label}} -> Name of the document form

{{fil.author}} -> Document author

{{user_to.first_name}} -> Prints the recipient's name

{{current_user}} -> User who runs the operation. It may not always be available.

Include the link to the document in the email body

You can add in the Body a direct link to the document for which the notification has been executed:

<a href="https://mycompany.athento.com/file/view/{{fil.uuid}}">{{fil.filename}}</a>

You just have to replace "mycompany" with the domain of your Athento instance.

Body example for a notification template

<div style="text-align: justify;">

<span style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;color:#666666;">

Dear user,

<br>

The document {{fil|gmv:"metadata.doc_code"}} is now ready.

You can access it from the link.

Remember that it is only valid until the next <b>{{fil|gmv:"metadata.expiration_date"}}</b>.

<br><br>

</span>

</div>

<br>

<a href="https://mycompany.athento.com/file/view/{{fil.uuid}}">{{fil.filename}}</a>

<br>

Extend from an Athento base template

You can reuse the styles of Athento notifications in your custom notifications. To do so, enter this tag at the beginning of the Body:

{% extends "email_notification/base_email_notification.html" %}

The custom content must be included between these tags:

{% block content %} here your custom content {% endblock content %}

A complete Body example would look like this:

{% extends "email_notification/base_email_notification.html" %}

{% load filetags %}

{% block content %}

<img style="height:50px;border-radius:50px" height="50" src="URL_de_tu_empresa" alt="Logo">

<br>

<div style="text-align: justify;">

<span style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px;line-height:24px;color:#666666;">

Dear user,

<br>

The document {{fil|gmv:"metadata.doc_code"}} is now ready.

You can access it from the link.

Remember that it is only valid until the next <b>{{fil|gmv:"metadata.expiration_date"}}</b>.

<br><br>

</span>

</div>

<br>

<a href="https://mycompany.athento.com/file/view/{{fil.uuid}}">{{fil.filename}}</a>

<br>

{% endblock content %}

Import or export a notification template between Athento installations

In the advanced administration of Notification templates, you will find the import and export buttons in the upper right corner.

To export templates, first select all the templates you want to include and then click the Export button. Next, you can choose the export format (csv, xls, json, etc.).

To import templates, select the file that contains the data and the corresponding file format.