Skip to content
28 changes: 28 additions & 0 deletions content/en/synthetics/notifications/template_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ Template variables allow you to insert dynamic values from your test results and

### Test execution variables

`{{synthetics.failed_step.failure.message}}`
: The error message (for example, `Element's content should match the given regex`).

`{{synthetics.failed_step.url}}`
: The URL of the failed step (for example, `https://www.datadoghq.com/blog/`).

`{{synthetics.attributes.result.response.statusCode}}`
: The HTTP status code (for example, `403`).

`{{synthetics.result.step_count}}`
: Number of steps (for example, `4`).

`{{synthetics.result.duration}}`
: Duration of the test run (in milliseconds) (for example, `9096`).

`{{tags}}`
: Lists all the tags added to the synthetics test.
: To access individual tag values, use `{{tags.<tag-key>}}`. For example, if your test is tagged with `env:prod`, use `{{tags.env}}` to return the tag value `prod`.

### Result attributes
Use these variables to include details about the test, execution location, device, counts, and result status in your notification messages.

{{< tabs >}}
Expand Down Expand Up @@ -131,6 +151,14 @@ Applies to Multistep, Browser, and Mobile tests.
`{{synthetics.attributes.count.hops}}`
: The number of traceroute hops for TCP and ICMP tests

{{% /tab %}}
{{% tab "Failed Step" %}}

Applies to Multistep, Browser, and Mobile tests.

`{{synthetics.failed_step}}`
: The `failed_step` object provides a shortcut to the data for the step in `{{synthetics.attributes.result.steps}}` that caused the test to fail. For example, `{{synthetics.failed_step.name}}` maps to `{{synthetics.attributes.result.steps.<step-index>.name}}`, the failing step's name.

{{% /tab %}}
{{< /tabs >}}

Expand Down
Loading