1. Help Center
  2. Automate workflow

DevicePilot template language

This page describes the template syntax for actions

You can customise the actions sent by DevicePilot using any properties on the device or rule. We use a standard template grammar called Handlebars (which is an extension to Moustache, named for the curly brackets it uses looking like facial hair).

Here is a simple example:

The device at {{source.label}} is down!

which will transform to

The device at Ada St & Washington Blvd is down!

The double curly brackets open a replacement, and in this case we're going to take the value of the label property on the device. You can access any property on your device this way.

You also have access to information about the rule that triggered:

{{rule.name}} - the name of the rule

{{rule.$ts}} - the timestamp of this trigger

{{rule.state}} - true/false. true: the trigger has just fired, false: the trigger has just cleared

{{rule.url}} - a URL that will open the affected device(s) in DevicePilot

The list of supported handlebars-helpers namespaces are:

  • array
  • collection
  • comparison
  • inflection
  • math
  • markdown
  • number
  • object
  • string
  • url