Template variables and {{ … }} reference

Template variables and {{ … }} reference

Complete reference for the {{ … }} substitution language used by Custom JSON templates and by URL / headers / query parameters on the webhook form. Read Custom JSON template first for the conceptual model — this page is the dictionary.


Root context — always available

These identifiers can start any placeholder path:

Identifier

Description

Identifier

Description

event

Forge event key, e.g. avi:jira:updated:issue

timestamp

ISO 8601 delivery timestamp, e.g. 2026-05-04T10:30:45.000Z

author

accountId of the user who triggered the event (may be null)

baseUrl

Jira site URL, e.g. https://acme.atlassian.net

issueKey

e.g. ABC-42 — null for non-issue events

issueId

numeric — null for non-issue events


Family-specific bindings

Set according to the event family. Bindings that don't apply to the current event stay null, so unused {{ … }} paths resolve cleanly without breaking JSON.

Binding

Populated for events

Source

Binding

Populated for events

Source

issue

Issue, Comment, Worklog, Attachment, Issue Link

REST API (or event snapshot)

comment

commented:issue, updated:comment, deleted:comment, mentioned:comment

event snapshot

worklog

created:worklog, updated:worklog, deleted:worklog

event snapshot

attachment

created:attachment, deleted:attachment

event snapshot

issueLink

created:issuelink, deleted:issuelink

event snapshot

project

All project lifecycle events

event snapshot

version

All version lifecycle events

event snapshot

component

All component lifecycle events

event snapshot

user

All user lifecycle events

event snapshot

filter

All filter lifecycle events

event snapshot

issueType

All issue-type lifecycle events

event snapshot

field

All custom field lifecycle events

event snapshot

fieldContext

All custom field context lifecycle events

event snapshot

entity

Any event — alias for whichever binding above is populated

—

{{entity.…}} is the family-agnostic escape hatch. Use it for templates that should handle several event types and only need common properties like {{entity.id}}, {{entity.name}}.


Path syntax

Dot-notation only. No numeric [0] indices.

{{issue.key}} {{issue.status.name}} {{issue.assignee.displayName}} {{comment.body.content.first.content.first.text}} {{baseUrl}}/browse/{{issue.key}}

The .fields shortcut

You can skip the .fields. hop when reaching into a Jira issue:

{{issue.summary}} ← shortcut {{issue.fields.summary}} ← explicit form, also works

The resolver checks top-level (key, id, self, changelog, …) first, then .fields.


Array accessors — first, last, length

Three special segment names that work on any array-like value:

{{issue.comment.first}} → first comment (object) {{issue.comment.last}} → most recent comment {{issue.comment.length}} → number of comments on this page {{issue.comment.first.body.content}} → ADF body content of the first comment {{issue.comment.first.author.displayName}} → "John Doe" {{issue.worklog.last.timeSpent}} → time on the latest worklog {{issue.labels.first}} → first label (string) {{issue.labels.length}} → label count {{issue.fixVersions.last.name}} → most recent fix version's name

These work on:

  • Plain arrays (labels, fixVersions, attachment, subtasks, …).

  • Jira pagination wrappers (comment, worklog) — peek into the inner array automatically.

If a real Jira field happens to be named first / last / length, regular property access wins for objects; the virtual accessor only triggers when the current value is array-like.


Pagination wrapper auto-unwrap

Jira returns some fields wrapped in pagination envelopes:

issue.comment = { comments: […], total, maxResults, startAt } issue.worklog = { worklogs: […], total, maxResults, startAt }

Picking these in a Fields template, or writing {{issue.comment}} in Custom JSON, returns the inner array directly — no extra .comments / .worklogs hop needed.

If you want the envelope itself, keep going on the path:

{{issue.comment.total}} → 3 {{issue.comment.maxResults}} → 1 {{issue.comment.startAt}} → 0

Detection is structural: any future Jira field with the { inner-array, total, maxResults, startAt } shape unwraps automatically.


Comment / worklog / attachment fields on the issue

Webhooks Pro asks Jira for these explicitly so they're always populated when present:

GET /rest/api/3/issue/{key}?fields=*all,comment,worklog,attachment&expand=renderedFields,changelog

So {{issue.comment}}, {{issue.worklog}}, {{issue.attachment}} always return the data when the issue has any. Custom-field rendered HTML (expand=renderedFields) is included for templates that need the HTML form of a wiki-marked field. changelog is included so templates can inspect what changed: {{issue.changelog.histories.last.items}}.


ADF body structure

Comments and rich-text custom fields come back as Atlassian Document Format — a tree of nodes, not plain text:

{ "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "First line" } ] }, { "type": "paragraph", "content": [ { "type": "text", "text": "Second line, " }, { "type": "mention", "attrs": { "id": "..." } } ] } ] }

body.content → array of block nodes (paragraph, heading, bulletList, …). Each block has content → array of inline nodes (text, mention, emoji, …). Plain text lives two levels deep, not directly on the block.

Combined with first / last:

{{comment.body.content.first.content.first.text}} → "First line" {{comment.body.content.last.content.first.text}} → "Second line, " (the mention is the second inline node)

For a flat string, pull the whole body and let the receiver flatten — flatten logic depends on what the downstream expects (mentions as @username vs ids, emoji as unicode vs shortcode).


Workflow post function — entity.* bindings

When a webhook fires from the Trigger Webhook post function (Trigger Webhook post function), an extra snapshot under entity covers the transition that ran:

Path

Description

Path

Description

entity.transition.id

Jira transition id

entity.transition.name

Transition name (e.g. "Resolve Issue")

entity.transition.from

Source status object ({id, name}) — null on global transitions

entity.transition.from.name

Source status name

entity.transition.to.id

Target status id

entity.transition.to.name

Target status name

entity.workflow.id

Workflow id

entity.workflow.name

Workflow name

entity.changelog.items

Array of {field, fromString, toString, …} entries

entity.changelog.items.first.field

First changed field on this transition

entity.changelog.items.first.toString

New value of that field

entity.comment

Comment entered in Jira's transition dialog (full object)

entity.comment.author.displayName

Comment author

entity.comment.body

ADF body

{{issue.*}} is also available on post-function deliveries — the post function passes the full issue alongside entity.

The transition comment is enriched server-side: Forge delivers a slim stub { id: "10248" }; Webhooks Pro looks it up in the issue's fields.comment.comments[] and swaps the stub with the full comment object so entity.comment.body, .author, .created all resolve.


Formatters

Append :type(pattern) to a placeholder for explicit formatting:

Type

Purpose

Pattern

Type

Purpose

Pattern

:number(<pattern>)

Format a numeric value

DecimalFormat tokens (see below)

:date(<pattern>)

Format a Date or ISO 8601 string

UTC tokens (see below)

:json

Force JSON.stringify regardless of type

none

:string

Force string coercion

none

Unknown formatter types raise a render warning → the delivery falls back to Default and the log shows the message.

Date patterns (UTC, deterministic)

Token

Example

Meaning

Token

Example

Meaning

yyyy

2026

Full year

yy

26

Two-digit year

MMMM

January

Month name (full, English)

MMM

Jan

Month name (abbreviated)

MM

01

Month number (01–12)

EEEE

Sunday

Day of week (full, English)

EEE

Sun

Day of week (abbreviated)

dd

15

Day of month (01–31)

HH

10

Hour 24h (00–23)

mm

30

Minute (00–59)

ss

45

Second (00–59)

SSS

123

Millisecond (000–999)

Other characters in the pattern are kept as literals. Without a pattern, :date returns the ISO string.

{{issue.updated:date(yyyy-MM-dd HH:mm)}} → "2026-05-04 10:30" {{issue.duedate:date(dd/MM/yyyy)}} → "15/05/2026"

Number patterns

Token

Meaning

Token

Meaning

0

Required digit (pads with 0)

#

Optional digit (omitted when zero)

.

Decimal separator

,

Thousands separator

%

Percent (multiplies by 100, appends %)

{{sp:number(0.00)}} for sp = 3.1 → "3.10" {{sp:number(0.##)}} for sp = 3.1 → "3.1" {{amount:number(#,##0)}} for 12345 → "12,345" {{amount:number(#,##0.00)}} for 1234.5 → "1,234.50" {{progress:number(0%)}} for 0.75 → "75%"

Without a pattern, :number returns the default String(number).

Null / undefined with formatters

When a formatter is applied, missing values produce an empty string "" — regardless of type. (For whole-quote placeholders without a formatter, missing values become null.)


Substitution modes (Custom JSON only)

Position

Behaviour

Position

Behaviour

Whole-quote "{{path}}" (only content of a JSON string)

Replaces the wrapping "…" with the native JSON of the value. Type is preserved (number stays number, object stays object). Missing → null.

In-string "prefix {{path}} suffix"

Substitutes a string. Objects/arrays are JSON.stringify-ed. Missing → "".

In URL / headers / query params, only the in-string mode applies (those are plain strings, not JSON).


URL, headers, and query params

The same {{ … }} syntax works in Webhook URL, HTTP Headers (key and value), and URL Parameters (key and value):

URL https://api.example.com/issues/{{issue.key}}/events Header X-Issue-Key = {{issue.key}} Header X-Event = {{event}} Query project = {{issue.project.key}} Query date = {{timestamp:date(yyyy-MM-dd)}}

In the URL, substituted values are URL-encoded automatically (encodeURIComponent). Literal characters (:, /, ?, =, #) stay as written.

In headers, substituted values are not URL-encoded (HTTP doesn't require it). In query params, values are encoded when assembled into the URL — that's what URLSearchParams does natively.

Don't put secrets in placeholders. Authorization / API keys belong in literal header values. Pulling a token from {{issue.customfield_…}} leaks it into delivery logs.

The URL path itself (the static parts you wrote) is not substituted — only {{ … }} segments are. If you need a fully dynamic URL path, build it from query parameters or route on the receiver side.


Render warnings to watch for

In Webhook Logs, the error column on a delivery row surfaces:

  • [WARNING] Header "X-Foo" render failed: … — a header / query placeholder produced an invalid value or used an unknown formatter.

  • [WARNING] Custom JSON template render failed: … — the body didn't parse after substitution. The delivery falls back to Default.

Both are non-fatal — the delivery still goes out — but indicate a template bug worth fixing.


Related