Skip to main content
Version: v5.0

Templates

Overview#

A template is an outline of the email notification which is sent out to invite people to subscribe to a group. This is similar to how templates are used in the Passport Service.

Velocity templates#

In a template object, the subject and body properties are Velocity templates. Velocity is a Java-based template engine. For more information on Velocity, visit Apache Velocity Project.

Velocity templates parameters#

In a Velocity template the following parameters are available:

ParameterTypeDescription
cancelAllLinkStringURL to block the device from receiving notifications. Should always be included in a normal email template.
cancelLinkStringURL to cancel the subscription. Should always be included in a normal email template.
acceptLinkStringURL to confirm the subscription. Should only be included in emails associated with the SUBSCRIBE_VERIFY action in a sender.
requestObjectThe request payload (for an EVENT trigger, this is the body of the event).
deviceDeviceThe device object (fields are those on the Device object: email, id, owner, etc.).
senderSenderThe sender object (fields are those on the Sender object: id, email, displayName, etc.).
groupGroupThe group object, if present. Fields are those on the Group object.

Template guidelines#

Some general guidelines for using templates, include:

  • Always include cancelLink and cancelAllLink in your email templates to allow user control.
  • Include the acceptLink only for emails related to the SUBSCRIBE_VERIFY action in a sender.

Template examples#

Standard Notification Email (Velocity syntax)#

<html>  <body>    <h2>Hello from $applicationName!</h2>    <p>Your device: $device.email.address</p>    <p>      <a href="$cancelLink">Cancel Subscription</a> |      <a href="$cancelAllLink">Block Device</a>    </p>    <p>Request details: $request</p>    #if($group)      <p>Group: $group.name</p>    #end  </body></html>

SUBSCRIBE_VERIFY Email (Velocity syntax)#

<html>  <body>    <h2>Subscription Verification - $applicationName</h2>    <p>Your device: $device.email.address</p>    <p>      <a href="$acceptLink">Confirm Subscription</a>    </p>    <p>Request details: $request</p>    #if($group)      <p>Group: $group.name</p>    #end  </body></html>