You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`{{$UUID}}`| Generates a random UUID/v4 (e.g., `9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d`) |
94
-
|`{{$RANDOM_NUMBER}}`| Generates a random decimal number between 0 and 1000 (e.g., `345`) |
95
-
|`{{moment}}`| Generates dates/times using **moment.js** with formatting: |
91
+
Webhook templates support [Handlebars built-in helpers](https://handlebarsjs.com/guide/builtin-helpers.html), such as `if`, `unless`, and `each`, as well as these Checkly helpers:
96
92
97
-
-`{{moment "YYYY-MM-DD"}}` → `2020-08-26`
98
-
-`{{moment "2 days ago" "YYYY-MM-DD"}}` → `2020-08-24`
99
-
-`{{moment "last week" "X"}}` → `1597924480`
93
+
| Helper | Example | Description |
94
+
| --- | --- | --- |
95
+
|`$UUID`|`{{$UUID}}`| Generates a random UUID v4, such as `9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d`. |
96
+
|`$RANDOM_NUMBER`|`{{$RANDOM_NUMBER}}`| Generates a random integer from 0 through 10,000. |
97
+
|`tagValue`|`{{tagValue TAGS "team" "UNKNOWN"}}`| Returns the value from the first matching `team:value` or `team=value` tag. Returns the optional final argument when no tag matches. |
98
+
|`startsWith`|`{{startsWith value "prefix:"}}`| Returns whether a string starts with the supplied prefix. |
99
+
|`replace`|`{{replace value "old" "new"}}`| Replaces the first matching string. |
100
+
|`split`|`{{split "a,b,c" "," 1}}`| Splits a string and returns the item at the supplied zero-based index. |
101
+
|`year`|`{{year}}` or `{{year 2}}`| Returns the current year with four or two digits. |
102
+
|`date`, `moment`|`{{date "YYYY-MM-DD"}}`| Formats the current date. The two helper names are aliases. |
100
103
101
-
<Note>
102
-
You can find the [full list of helpers in the README.md file](https://github.com/checkly/handlebars) of the underlying library we are using. For a full overview of date formatting option, check the [moment.js docs](https://momentjs.com/docs/#/displaying/format/).
103
-
</Note>
104
+
#### Get a value from a tag
105
+
106
+
Use `tagValue` when your tags store key-value metadata. Given these tags:
107
+
108
+
```text
109
+
team:payments
110
+
environment=production
111
+
```
104
112
105
-
You can also use conditional helpers like `{{#eq}}` statements. Here is an example:
113
+
This template:
114
+
115
+
```handlebars
116
+
{{tagValue TAGS "team" "UNKNOWN"}}
117
+
```
118
+
119
+
renders `payments`. Both `:` and `=` separators are supported. If neither `team:...` nor `team=...` exists, the template renders the fallback `UNKNOWN`. If multiple tags match, Checkly returns the first one.
120
+
121
+
<Tip>
122
+
Send a test message from the webhook editor to inspect the rendered request before saving your alert channel.
123
+
</Tip>
124
+
125
+
#### Format dates and times
126
+
127
+
The `date` and `moment` helpers support [Day.js-compatible format tokens](https://day.js.org/docs/en/display/format). You can format the current time, an absolute date, or relative phrases such as `yesterday`, `2 days ago`, and `last week`.
128
+
129
+
-`{{date "YYYY-MM-DD"}}` formats the current date, for example as `2026-07-24`.
-`{{moment "2 days ago" "YYYY-MM-DD"}}` formats the date from two days ago.
132
+
-`{{moment "last week" "X"}}` formats last week as a Unix timestamp.
133
+
134
+
#### Compare values
135
+
136
+
Use comparison helpers as blocks or subexpressions where applicable. Available helpers include:
137
+
138
+
- Equality and ordering: `eq`, `is`, `isnt`, `gt`, `gte`, `lt`, `lte`, and `compare`.
139
+
- Boolean logic: `and`, `or`, `not`, `neither`, `isTruthy`, and `isFalsey`.
140
+
- Value checks: `contains`, `has`, and `default`.
141
+
- Numeric conditions: `ifEven`, `ifOdd`, and `ifNth`.
142
+
- Inverse comparisons: `unlessEq`, `unlessGt`, `unlessGteq`, `unlessLt`, and `unlessLteq`.
143
+
144
+
For example:
106
145
107
146
```json
108
147
{
@@ -127,8 +166,6 @@ Two clear benefits here:
127
166
- You only need to create one webhook to inform a 3rd party system.
128
167
- You can translate Checkly terms to your 3rd party tool's term for the same concept, i.e. the "up status" of a check.
129
168
130
-
You can find the [full list of helpers in the README.md file](https://github.com/checkly/handlebars) of the underlying library we are using.
131
-
132
169
## Webhook Secrets
133
170
134
171
You can validate each webhook we deliver to your endpoint(s). Using the optional webhook secret, you can:
@@ -447,4 +484,4 @@ An example body could look as follows:
447
484
448
485
For full details on creating issues via the Jira API, see [Atlassian's documentation for this endpoint](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post).
449
486
450
-
You can also use version 2 of the Jira API (i.e. `{{JIRA_INSTANCE_URL}}/rest/api/2/issue`). The only difference is that version 2 does not support [Atlassian Document Format (ADF)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/).
487
+
You can also use version 2 of the Jira API (i.e. `{{JIRA_INSTANCE_URL}}/rest/api/2/issue`). The only difference is that version 2 does not support [Atlassian Document Format (ADF)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/).
Copy file name to clipboardExpand all lines: platform/snippets/handlebars-snippets.mdx
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,4 @@ Notice three things:
99
99
100
100
## Using Handlebars helpers
101
101
102
-
We've extended the [Handlebars](https://handlebarsjs.com/) templating system with some handy helpers to make our webhooks
103
-
even more powerful.
104
-
105
-
You can find the [full list of helpers in the README.md file](https://github.com/checkly/handlebars) of the underlying library we are using.
102
+
Webhook templates support additional Checkly helpers for extracting tag values, formatting dates, comparing values, and transforming strings. See [Handlebars helpers for webhooks](/integrations/alerts/webhooks#handlebars-helpers) for the supported helpers and examples.
0 commit comments