Jirassimo template examples

For template parsing Jirassimo is using Mustache templating engine.

Jirassimo communicates with your JIRA using webhooks and REST API and that means it works with JIRA issue objects in JSON format.

Here is the example of JIRA issue in JSON format

      "expand": "renderedFields,names,schema,transitions,editmeta,changelog",
      "id": "10000",
      "self": "http://localhost:8090/jira/rest/api/2/issue/10000",
      "key": "MKY-1",
      "fields": {
          "summary": "First Test Issue",
          "issuetype": {
              "self": "http://localhost:8090/jira/rest/api/2/issuetype/1",
              "id": "1",
              "description": "A problem which impairs or prevents the functions of the product.",
              "iconUrl": "http://localhost:8090/jira/images/icons/bug.gif",
              "name": "Bug",
              "subtask": false
          "status": {
              "self": "http://localhost:8090/jira/rest/api/2/status/1",
              "description": "The issue is open and ready for the assignee to start work on it.",
              "iconUrl": "http://localhost:8090/jira/images/icons/status_open.gif",
              "name": "Open",
              "id": "1"
          "labels": [ ],
          "votes": {
              "self": "http://localhost:8090/jira/rest/api/2/issue/MKY-1/votes",
              "votes": 0,
              "hasVoted": false
          "workratio": -1,
          "assignee": {
              "self": "http://localhost:8090/jira/rest/api/2/user?username=admin",
              "name": "admin",
              "emailAddress": "admin@example.com",
              "avatarUrls": {
                  "16x16": "http://localhost:8090/jira/secure/useravatar?size=small&avatarId=10062",
                  "48x48": "http://localhost:8090/jira/secure/useravatar?avatarId=10062"
              "displayName": "Administrator",
              "active": true
          "fixVersions": [ ],
          "resolution": null,
          "attachment": [ ],
          "resolutiondate": null,
          "reporter": {
              "self": "http://localhost:8090/jira/rest/api/2/user?username=admin",
              "name": "admin",
              "emailAddress": "admin@example.com",
              "avatarUrls": {
                  "16x16": "http://localhost:8090/jira/secure/useravatar?size=small&avatarId=10062",
                  "48x48": "http://localhost:8090/jira/secure/useravatar?avatarId=10062"
              "displayName": "Administrator",
              "active": true
          "project": {
              "self": "http://localhost:8090/jira/rest/api/2/project/MKY",
              "id": "10001",
              "key": "MKY",
              "name": "monkey",
              "avatarUrls": {
                  "16x16": "http://localhost:8090/jira/secure/projectavatar?size=small&pid=10001&avatarId=10011",
                  "48x48": "http://localhost:8090/jira/secure/projectavatar?pid=10001&avatarId=10011"
          "versions": [ ],
          "environment": null,
          "updated": "2011-11-22T09:23:02.302+1100",
          "created": "2011-11-22T09:22:59.899+1100",
          "priority": {
              "self": "http://localhost:8090/jira/rest/api/2/priority/3",
              "iconUrl": "http://localhost:8090/jira/images/icons/priority_major.gif",
              "name": "Major",
              "id": "3"
          "description": null,
          "duedate": null,
          "components": [ ],
          "comment": {
              "startAt": 0,
              "maxResults": 1,
              "total": 1,
              "comments": [
                      "self": "http://localhost:8090/jira/rest/api/2/issue/10000/comment/10000",
                      "id": "10000",
                      "author": {
                          "self": "http://localhost:8090/jira/rest/api/2/user?username=admin",
                          "name": "admin",
                          "emailAddress": "admin@example.com",
                          "avatarUrls": {
                              "16x16": "http://localhost:8090/jira/secure/useravatar?size=small&avatarId=10062",
                              "48x48": "http://localhost:8090/jira/secure/useravatar?avatarId=10062"
                          "displayName": "Administrator",
                          "active": true
                      "body": "comment",
                      "updateAuthor": {
                          "self": "http://localhost:8090/jira/rest/api/2/user?username=admin",
                          "name": "admin",
                          "emailAddress": "admin@example.com",
                          "avatarUrls": {
                              "16x16": "http://localhost:8090/jira/secure/useravatar?size=small&avatarId=10062",
                              "48x48": "http://localhost:8090/jira/secure/useravatar?avatarId=10062"
                          "displayName": "Administrator",
                          "active": true
                      "created": "2011-11-22T09:23:02.129+1100",
                      "updated": "2011-11-22T09:23:02.129+1100",
                      "visibility": {
                          "type": "role",
                          "value": "Administrators"
          "watches": {
              "self": "http://localhost:8090/jira/rest/api/2/issue/MKY-1/watchers",
              "watchCount": 0,
              "isWatching": false


Important! Even when just one issue is returned in the resultset - you have to reference it using {{#issues}} iterator

Custom fields are referenced absolutelly the same way - you just have to know exact name of the field, including custom field id (example: customfield_15931)

Hello World

{{#issues}} {{key}} {{#fields}} {{summary}} {{/fields}} {{/issues}}

Will produce the following result:

Hello my issue: MKY-1 First Test Issue

Show task name and assignee

{{#issues}} New issue {{key}} has been added by {{#fields}} {{assignee.name}}, {{assignee.emailAddress}} {{/fields}} {{/issues}}

Will produce the following result:

New issue MKY-1 admin, admin@example.com

Listing comments

Hello! This template shows all comments of all issues {{#issues}} Issue {{key}} comments: {{#fields}} {{#comment.comments}} {{body}} by "{{author.emailAddress}}", {{/comment.comments}} {{/fields}} {{/issues}} And some static content in the end.

Will produce the following result:


This template shows all comments of all issues
Issue MKY-1
comment by "admin@example.com",

And some static content in the end.
If the issue has more comments then each comment will be added in the format "{{body}} by "{{author.emailAddress}}"" to the message

Getting the last comment

{{#issues}} {{#fields}} {{#comment.comments}} {{#if @last}} {{#isSameUpdate firstDate=updated secondDate=fields.updated}} {{author.displayName}} - {{body}} {{/isSameUpdate}} {{/if}} {{/comment.comments}} {{/fields}} {{/issues}}

This example will render the last added comment and should be used with issue_updated event.

Using value from settings

{{#issues}} {{#fields}} {{#settingValue key=customfield_10000}}{{/settingValue}} {{/fields}} {{/issues}}

You can specify your own properties and retrieve them from the template. Just provide them in format name=value and retrieve using {{#settingValue key=YOUR_PROP_KEY}}{{/settingValue}}. This can be useful when you need to send notifications to dynamic destinations and the destination address needs to be resolved based on the value of specific field.

Constructing a dynamic list of email recipients from issue data

{{#issues}} {{#fields}} {{#comment.comments}} {{author.emailAddress}}, {{/comment.comments}} {{/fields}} {{/issues}}

You can construct dynamically the list of recipients based on issue data. In this example we extract comment authors' emails.
You will need to place it in the "Email or distribution list" field. The code will produce the following result:


Conditional statements

{{#issues}} {{#fields}} {{project.name}} - {{summary}} {{#equals first=context.today second=customfield_10000}} - Event that is due: Custom A - Due: {{customfield_10000}} {{/equals}} {{/fields}} {{/issues}}

You can write if-type statements that will evaluate against the real data from Issue. This is an example on how to show specific fields if issue's due date is today.
This template will check if customfield_10000 value is equal to current date and only in that case will render the content

Working with Context

{{#issues}} {{#fields}} {{project.name}} - {{summary}} {{#equals first=context.today second=customfield_10001}} {{#equals first=context.destination second=assignee.emailAddress}} - Event that is due: Custom A - Due: {{customfield_10000}} {{/equals}} {{/equals}} {{/fields}} {{/issues}}

Jirassimo provides "context" object that you can use in templates to access generic data, such as current date or channel destination. This example shows how to use it with double AND condition

Checking if particular field was changed

{{#issues}} {{#lastchange.items}} {{#equals first=field second="description"}} Description was changed to {{toString}} by {{lastchange.author.displayName}} {{/equals}} {{/lastchange.items}} {{/issues}}

Jirassimo provides "last_change" JSON property on JIRA issue so that you can use it in templates as a first-class property to check what, when and who has changed in the issue last time
This template will check if description of issue was changed and if so, the message will be sent to some channel

Formatting datetime fields

{{#issues}} {{#fields}} Project: {{project.name}} Issue type: {{issuetype.name}} Date and time of creation: {{#formatDate date="{{created}}" format="dd MMM yy hh:mm"}}{{/formatDate}} Reporter: {{reporter.name}} {{/fields}} {{/issues}}

By default, JIRA json is returning datetime fields in the following form: 2015-12-10T14:25:20.374+1100 which is fine for computers, but hard to read for humans. In Jirassimo templates you can use dedicated tag to format JIRA dates into human-friendly format, like this: DD MMM YY at hh:mm.

We use ISO 8601 format for displaying dates. For mor information, refer to https://en.wikipedia.org/wiki/ISO_8601

Sending JIRA attachment together with message

{{#includeAttachments pattern=".*.pdf"}} {{/includeAttachments}}

Jirassimo lets you send attachments from JIRA issues to user-defined channel in the same way as it works with regular text messages. To "pick-up" attachments from issue use the following tag: {{#includeAttachments}} {{/includeAttachments}}. It can be put in any place in template, but for better readability consider beginning or end of template.
It is possible to even further refine which types will be sent (by file extension)

This example will send all PDF files from the issue

Accessing metadata from issue description created by Issue Collector

Hello {{#issues}} {{issueCollector.reporter}} {{issueCollector.email}} {{/issues}}

Jirassimo supports accessing metadata set by JIRA Issue Collector

When you use JIRA Issue Collector, issues which are created by this method have description set with reporter name and email in
a not very convenient to read way. Jirassimo preparses this for you into a more structured way and allows to access it easily in
a template.

There are 2 fields you can access: reporter and email. Referencing an email field is useful in Jirassimo Email/Distribution list field.

Using custom Avatars for Slack

{{#customBotAvatar iconUrl="http://lorempixel.com/48/48"}}{{/customBotAvatar}}

You can supply your own icons for Jirassimo BOT in Slack channel

For that, include the above tag into the end of your template.

Version created notification

A new version {{version.name}} was created in {{version.project.name}} by {{context.currentUserDisplayName}} on {{#if version.userReleaseDate}}{{#formatDate date="{{version.userReleaseDate}}" format="dd MMM yyyy"}}{{/formatDate}}{{/if}} ({{version.description}})

Version released notification

The version {{version.name}} in {{version.project.name}} was released on {{#if version.userReleaseDate}}{{#formatDate date="{{version.userReleaseDate}}" format="dd MMM yyyy"}}{{/formatDate}}{{/if}} by {{context.currentUserDisplayName}} ({{version.description}})

Version unreleased notification

Version {{version.name}} was unreleased by {{context.currentUserDisplayName}}. For more information contact {{context.currentUserEmail}}

Version moved notification

Version {{version.name}} was moved by {{context.currentUserDisplayName}}

Version update notification

The version {{version.name}} was updated by {{context.currentUsername}} Description: {{version.description}} overdue: {{version.overdue}} project: {{version.project.name}}

Version deleted notification

User {{context.currentUserDisplayName}} deleted version {{version.name}}

Version merged notification

The version {{version.name}} was merged into {{mergedTo.name}}

Project created

{{context.currentUserDisplayName}} just created a new project {{project.name}}. Lead is {{project.projectLead.displayName}}

Project updated

{{context.currentUserDisplayName}} has updated project {{project.name}}. New values are projectLead: {{project.projectLead.displayName}} key: {{project.key}}

Project deleted

User {{context.currentUserDisplayName}} has deleted {{project.name}}