# Templating language

To create dynamic templates that can be used directly in our backend we use Go:s built-in templating language. Below is a brief description of the syntax.

# Basic syntax

Some variables as described below can be included in messages templates and other config parameters. The template string uses double {{}} brackets with the path to the variable from the root object denoted with a dot (.).

Example

Your {{.installation.Name}} reported a temperature of {{.payload.value}}{{.payload.unit}}.

Using this template on an installation named "Summer house" with parameters value (24.5 )and unit (°C) in the POST data will result in a message like the following.

Your Summer house reported a temperature of 24.5°C

More details about Golang Templating can be found in their documentation (opens new window).

# Injected data

The following is a list of all data that is injected into the template when it's executed.

Var name Description
.installation.ID ID of the installation
.installation.Name Name of the installation
.installation.ClientID Client ID of the installation
.organization.ID ID of the organisations that the installation belongs to
.organization.Name Name of the organisations that the installation belongs to
.organization.Address.Address Address of the organisations that the installation belongs to
.organization.Address.City City of the organisations that the installation belongs to
.organization.Address.Country Country of the organisations that the installation belongs to
.organization.Address.ZIP ZIP code of the organisations that the installation belongs to
.organization.Email Contact email of the organisations that the installation belongs to
.organization.Phone Contact phone number of the organisations that the installation belongs to
.organization.Notes Notes in the organisations that the installation belongs to
.payload.* All JSON data included in the POST request when sending